Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Bulk insert/delete

Re: Bulk insert/delete

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: 30 May 2006 11:25:38 -0700
Message-ID: <1149013538.815063.301310@r44g2000cwb.googlegroups.com>

  1. Why are you re-inserting in FORALL? You're supposed to delete what you don't need and leave what you need intact... That code just doesn't make sense to me?
  2. Given the amount of data you need to purge, you can do either of these:

CREATE GLOBAL TEMPORARY TABLE TEMP_T
ON COMMIT PRESERVE ROWS
AS SELECT * FROM TABLE1
WHERE <your_predicates_for_data_to_keep>; TRUNCATE TABLE TABLE1 DROP STORAGE;
INSERT INTO TABLE1 SELECT * FROM TEMP_T; TRUNCATE TABLE TEMP_T; -- to avoid ORA-14452 DROP TABLE TEMP_T; which is slower, but will not invalidate dependent objects, like stored procedures, and will not drop indexes, or

CREATE TABLE TEMP_T AS SELECT * FROM TABLE1 WHERE <your_predicates_for_data_to_keep>; DROP TABLE TABLE1;
RENAME TABLE TEMP_T TO TABLE1;
-- recreate indexes you had on TABLE1 here

Be sure to recreate indexes on new TABLE1 in this case, because they will be dropped with old incarnation.

Hth,

    Vladimir M. Zakharychev
    N-Networks, makers of Dynamic PSP(tm)     http://www.dynamicpsp.com Received on Tue May 30 2006 - 13:25:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US