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

Home -> Community -> Usenet -> c.d.o.server -> Re: archiving records

Re: archiving records

From: Daud <daud11_at_hotmail.com>
Date: 28 Aug 2006 02:50:57 -0700
Message-ID: <1156758657.722482.116030@b28g2000cwb.googlegroups.com>


Actually, I have over simplified the code too much. Here a slight modification to it.
My concern is whether I have archived the same rows that have been deleted from the primary table. Assume that no new rows with colA = 'ABC' will be inserted/updated when the code runs.

Daud

> ---------------------------------------------------------
> declare
> v_loop_count integer;
> begin
> SELECT COUNT(*)
> INTO v_loop_count
> FROM MYTAB
> WHERE

          colA = 'ABC' and
          ROWNUM < 100001;

>
> WHILE (v_loop_count > 0) LOOP
>
> INSERT INTO MYTAB_ARC
> SELECT * FROM MYTAB WHERE colA = 'ABC' and ROWNUM < 100001';
>
> DELETE FROM MYTAB WHERE colA = 'ABC' and ROWNUM < 100001;
> -- have i deleted the same 100K rows that just got inserted?
>
> COMMIT;
>
> SELECT COUNT(*)
> INTO v_loop_count
> FROM MYTAB
colA = 'ABC' and ROWNUM < 100001;
>
> END LOOP;
> end;
> /
Received on Mon Aug 28 2006 - 04:50:57 CDT

Original text of this message

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