Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORDER BY ROWID

Amigo3044Aug 7 2008 — edited Aug 11 2008
Oracle 9i
===========

Hi,

We are facing an issue where we have to copy any given table to an archive database (and then delete the source table). Due to undo space issues we have to commit frequently. The transportation is done through a dynamic SQL statement. The current logic inserts each row and then deletes the same row within a cursor loop; it commits at every predefined interval of say 10000 record. This logic errors out with an 02067 error which I assume is due to a large number of transactions over a distributed environment.

Can we do this -

INSERT INTO target SELECT * FROM src WHERE rownum <10001
ORDER BY ROWID;
DELETE FROM src WHERE ROWNUM <10001 ORDER BY ROWID;

Will this delete the same records that we have inserted? This way we can break the table into smaller chunks and reduce the number of transactions.

If anyone has a better idea (like how to tackle the 02067 error itself) then please let me know.

Thanks a lot.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2008
Added on Aug 7 2008
5 comments
6,482 views