daily pastebin goal
60%
SHARE
TWEET

PL/SQL - Chunk INSERT

Mayur_Pipaliya Feb 5th, 2013 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT Query : SELECT a,b,c,d,e FROM TABLE t2, TABLE t3, TABLE t4 WHERE conditions ;
  2. INSERT Query : INSERT INTO TABLE t1 (SELECT a,b,c,d,e FROM TABLE t2, TABLE t3, TABLE t4 WHERE conditions)
  3.  
  4.  
  5.  
  6. // Batch Process 0-500
  7. INSERT INTO TABLE t1
  8. (
  9.         SELECT * FROM
  10.         ( SELECT a.*, ROWNUM rnum FROM
  11.                 ( SELECT a,b,c,d,e FROM TABLE t2, TABLE t3, TABLE t4 WHERE conditions ) a
  12.           WHERE ROWNUM <= 500 )
  13.         WHERE rnum  >= 0;
  14. )
  15.  
  16. // Batch Process 501-1000
  17. INSERT INTO TABLE t1
  18. (
  19.         SELECT * FROM
  20.         ( SELECT a.*, ROWNUM rnum FROM
  21.                 ( SELECT a,b,c,d,e FROM TABLE t2, TABLE t3, TABLE t4 WHERE conditions ) a
  22.           WHERE ROWNUM <= 1000 )
  23.         WHERE rnum  >= 501;
  24. )
RAW Paste Data
Top