set serveroutput on
set echo on
DECLARE
TYPE subset_rt IS RECORD
( empno emp.empno%TYPE
, ename emp.ename%TYPE
, hiredate emp.hiredate%TYPE
, deptno emp.deptno%TYPE );
TYPE subset_aat IS TABLE OF subset_rt
INDEX BY PLS_INTEGER;
aa_subset subset_aat;
BEGIN
/* Some "source" data... */
SELECT ROWNUM, owner, created, 20
BULK COLLECT INTO aa_subset
FROM all_objects
WHERE ROWNUM <= 10;
/* Record-based insert and subset of columns... */
FORALL i IN 1 .. aa_subset.COUNT
INSERT INTO (SELECT empno, ename, hiredate, deptno FROM emp)
VALUES aa_subset(i);
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows inserted.');
END;
/
No comments:
Post a Comment