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 and get sys generated PK?

Re: Insert and get sys generated PK?

From: wozi <wozi_at_dhc.net>
Date: Wed, 9 Jun 1999 21:09:09 -0700
Message-ID: <522510B37996F41A.F1A60CAA7CE771AD.E63D8CE35EB1013A@lp.airnews.net>

KTL wrote in message <375EA9B7.6C2F70B2_at_retailsolutions.com>...
>I have a table that has a numberic primary key.
>I also have a sequence that populates the primary key via a Before
>Insert trigger.
>
>How can I insert a record, and GET the primary key assigned to that
>record all in one statement?
>
>The trigger just
>
>select filelist_seq.nextval
>into :new.filelistnbr
>from dual;

Without using the trigger to populate the primary key, here is a sample insert statement:

Insert into table_name
 values (filelist_seq.nextval,'John', 'Doe','California','USA');

hope that helps Received on Wed Jun 09 1999 - 23:09:09 CDT

Original text of this message

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