Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Insert and get sys generated PK?
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