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 -> Re: Retrieving the key of a newly inserted record

Re: Retrieving the key of a newly inserted record

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 20 Dec 2002 13:53:10 -0600
Message-ID: <u7ke4zczb.fsf@standardandpoors.com>


On 20 Dec 2002, claus_scherschel_at_operamail.com wrote:
> Hi everyone,
>
> I'm using an after insert trigger/sequence combination to
> create an incremental number for the table's primary key.
>
> I would like to write a stored procedure that executes an
> insert statement, writing the procedure's parameters into my
> table. That's not big deal. But I haven't a clue how to
> retrieve the primary key value of the new record. There's no
> other unique index which would help. Retrieving the row id
> would be sufficient, I think.

Use sequences.

On insert use seq_name.nextval then in same session you can ask for seq_name.currval.

-- 
Galen Boyer
Received on Fri Dec 20 2002 - 13:53:10 CST

Original text of this message

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