Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: archiving records
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;> end;
>
> 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;
![]() |
![]() |