Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting primary key right after insertion into the record
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