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: Getting primary key right after insertion into the record

Re: Getting primary key right after insertion into the record

From: spencer <spencerp_at_swbell.net>
Date: Sat, 16 Sep 2000 18:44:43 -0500
Message-ID: <_ATw5.650$5X4.99099@nnrp3.sbc.net>

N.B. the RETURING clause is not supported in versions before 8.1.

"Philip Stevenson" <flossie_at_paradise.net.nz> wrote in message news:969137130.276037_at_shelley.paradise.net.nz...
> Just use the returning clause for the insert statement
>
> eg
> Create or Replace Function InsertInfo(MyRecord MyTable%RowType) Return
> Number
> is
> Result :Integer;
> begin
> insert into mytable
> (line_id
> ,description0
> values
> (line_id_s.nextval
> ,myrecord.description)
> Returning line_id into Result;
>
> Return Result;
>
> Exception
> When others then
> Return null;
> end;
> end;
>
> If using Java return line_id into a bind variable (:result) .
Received on Sat Sep 16 2000 - 18:44:43 CDT

Original text of this message

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