Multiple Inserts with max+1
932957May 3 2012 — edited May 4 2012HI.
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.