Skip to Main Content

Oracle Database Discussions

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!

Insert from select on the same table: possible without side effects?

Squall867Aug 7 2015 — edited Aug 7 2015

I have a very big table T1, containing millions of records. I need to process its rows and create some new rows based on the selection.

Table T1 contains events and one of these, with code 100, is created by further elaboration of other events inside of the table.

My code would be the following:

insert /*+append */ into T1 (code,...) values (100, c1,c2,...)

select c1,c2... from T1 where (code=20 or code=10) and <other conditions>...

as you can see I am extracting rows from T1 to insert them again into T1 with a different code and I am using direct path in order to achieve good performances.

My fear is: as select is made from the same table would I risk some data loss? In general is this a good practice? Or is it better to create another table?

This post has been answered by Franck Pachot on Aug 7 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2015
Added on Aug 7 2015
7 comments
1,590 views