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

Home -> Community -> Usenet -> c.d.o.server -> Re: insert statement using a sequencer and query

Re: insert statement using a sequencer and query

From: Jurij Modic <jmodic_at_src.si>
Date: Mon, 13 Sep 1999 20:11:45 GMT
Message-ID: <37df596b.3823336@news.siol.net>


On Mon, 13 Sep 1999 14:15:05 -0600, "Larry Pettit" <larry.pettit_at_ps.net> wrote:

>I'm trying to do an insert with the first column being a sequence value and
>the rest coming from another table. Is it possible and if so what is the
>correct syntax or do I need to use a cursor? I've already created the
>sequence name_id_seq.
>
>Thanks
>
> insert into table_name (seq_val, name_text, code)
> values(name_id_seq.nextval,
> (select name_text, code from another_table));
>

INSERT INTO table_name (seq_val, name_text, code)   SELECT name_id_seq.nextval, name_text, code FROM another_table;

HTH, Jurij Modic <jmodic_at_src.si>
Certified Oracle DBA (7.3 & 8.0 OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Mon Sep 13 1999 - 15:11:45 CDT

Original text of this message

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