Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> subselect and autonumber
Hi!
I have an Oracle database insert problem! I have a table that I want to populate with records from another table. I use a subselect to do that, f.ex.:
Insert into table 1 (col1, col2, col3) Select colA, colB, colC from table 2 where colA = xxx;
This works fine! But now I want to have a column in table 1 with auto number. I have created a sequence seq1, and I imagine that the sql now should look like this:
Insert into table 1 (auto1, col1, col2, col3) Values (seq1.nextval, (Select colA, colB, colC from table 2 where colA = xxx));
But this does not work! Can anyone help me, perhaps with a "correct" sql?
Regards
RSJ Received on Wed Jan 14 2004 - 04:31:23 CST
![]() |
![]() |