Search This Blog

Friday, August 26, 2011

Bulk load insert - Example

create or replace
PROCEDURE MIKE_BULK_EXAMPLE
AS
/* Fetch into user defined PL/SQL table */
TYPE CC IS TABLE OF TAB1%ROWTYPE INDEX BY BINARY_INTEGER;
plsql_tab_TAB1 CC;

BEGIN

DBMS_MVIEW.REFRESH('TAB1','C');

delete ccinfo;
commit;

SELECT
a,
b,
c,
d
BULK COLLECT INTO plsql_tab_TAB1
FROM TAB1;

FOR ALL i IN plsql_tab_tab1.FIRST .. plsql_tab_tab1.LAST
INSERT MAIN_TABLE VALUES plsql_tab_tab(i);
COMMIT;
commit;

END MIKE_BULK_EXAMPLE;