Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> subselect and autonumber

subselect and autonumber

From: <rsj_at_gisportalen.dk>
Date: 14 Jan 2004 02:31:23 -0800
Message-ID: <bcfec966.0401140231.222a3628@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US