索引表-实现数组功能

DECLARE
TYPE comm_type_array IS TABLE OF NUMBER
INDEX BY BINARY_INTEGER;

comm_types comm_type_array;
begin 
comm_types(1)  := 401;
comm_types(2)  := 427;
comm_types(3)  := 413;
comm_types(4)  := 425;
comm_types(5)  := 406;
comm_types(6)  := 419;
comm_types(7)  := 409;
comm_types(8)  := 404;
comm_types(9)  := 414;
comm_types(10) := 408;
comm_types(11) := 407;
comm_types(12) := 426;
comm_types(13) := 416;
comm_types(14) := 12 ;
for i in 1..comm_types.count LOOP

INSERT INTO T_COMMISION_INFO
      (COMMISION_ID,
       AGENT_ID,
       ORGAN_ID,
       BRANCH_ID,
       DEPT_ID,
       AGGREGATION_ID,
       COMMISION_TYPE_ID,
       MONEY,
       AGENT_CATE)
      SELECT S_COMMISION_INFO__ID.NEXTVAL,
             T1.AGENT_ID,
             T1.ORGAN_ID,
             T1.BRANCH_ID,
             T1.DEPT_ID,
             688,
             comm_types(i),
             200,
             T1.Agent_CATE
        FROM t_agent t1
        where t1.agent_id = 2946089;
        
end LOOP; 

end;  

你可能感兴趣的:(pl/sql)