drop table t1 purge;

create table t1 as select * from emp where 1=2;


   ------------------------------


declare

 TYPE emp_record_table_type IS TABLE OF emp%rowtype

   INDEX BY PLS_INTEGER;


 n emp_record_table_type;

begin

 select * BULK COLLECT into n

 from emp

 order by sal desc;

    

 for i in n.first .. n.last loop

   insert into t1 values n(i);

   p(i||' elements');

 end loop;


 p(n(4).empno||' '||n(4).ename);

end;

/


   ------------------------------


select * from t1;

'Oracle > PL/SQL' 카테고리의 다른 글

15일차 # 7 - Explicit Cursors  (0) 2012.04.24
15일차 # nested table 초기화  (0) 2012.04.24
15일차 # 6-20: Using Collection Methods  (0) 2012.04.24
15일차 # 6-15: PL/SQL Collections  (0) 2012.04.24
15일차 # 6-14: Update with records  (0) 2012.04.24

+ Recent posts