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: <un2000_at_my-deja.com>
Date: Wed, 09 Jun 1999 22:51:19 GMT
Message-ID: <7jmr53$1c3$1@nnrp1.deja.com>


I donot think there is a way to do so in releases prior to Oracle8. But, if you are using Oracle8 you should be able to use the "returning" clause of the insert statement. ex. insert into TableName values(...
ilelist_seq.nextval, ... ) returning ColumnName into VariableName;
You donot need to use a trigger unless you want to.

In article <375EA9B7.6C2F70B2_at_retailsolutions.com>,   KTL <KTL_at_retailsolutions.com> wrote:
> 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;
>
> that is all..
>
> Suggestions.. ?
>
> -K
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Wed Jun 09 1999 - 17:51:19 CDT

Original text of this message

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