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!

Multiple Inserts with max+1

932957May 3 2012 — edited May 4 2012
HI.
I am trying to insert 20k rows into a table that already has 80k rows. The primary key of the column should be max+1 for each insert. There is no sequence created for the same. Any idea how to do it. the below does not work.

INSERT INTO TBL1
(SELECT (SELECT MAX(COL_key)+1 FROM TBL1),B,C FROM TBL2);

All the 20k records that are inserted have same col_key value because col_key is not updated on the fly to generate new max+1.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 1 2012
Added on May 3 2012
18 comments
18,637 views