Learn PL/SQL 1. How to use array(temp array)

Learn PL/SQL
1. How to use array(temp array)

create table test_caseid (caseid RAW(16), userid NUMBER(9,0), activeflag NUMBER(9,0) DEFAULT 0);

declare
   type array_t is varray(13) of NUMBER;
--temp table or create a table then sue cursor
   array array_t := array_t(116,113,47,108,112,117,110,107,114,109,115,111,106);
   v_guid varchar2(40); 
begin
       for j in 1..9 loop
-- for cout 
           v_guid := sys_guid();
--get caseid  guid
           for i in 1..array.count 
--get userid number
           loop
             --dbms_output.put_line(array(i));
             insert into test_caseid(caseid, userid) values (v_guid, array(i));
           end loop;  
       commit;
   end loop;
end;

 

posted on 2013-03-25 14:05  子虚乌有  阅读(190)  评论(0)    收藏  举报