Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to get back the inserted row?
A copy of this was sent to sriniv79_at_hotmail.com
(if that email address didn't require changing)
On Wed, 05 Jan 2000 18:44:15 GMT, you wrote:
>What is the best way to get the newly created row immediately after an
>insert? I am interested in getting the values of some columns filled in
>by an Insert Trigger.
>
look at the RETURNING clause of the insert/update statements (available with 8.0 and up)
tkyte_at_8.0> create table t ( a int, x date default sysdate );
Table created.
tkyte_at_8.0>
tkyte_at_8.0> declare
2 l_date date;
3 begin
4 insert into t (a) values ( NULL ) returning x into l_date;
5
5 dbms_output.put_line( l_date );
6 end;
7 /
05-JAN-00
PL/SQL procedure successfully completed.
>TIA.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Jan 05 2000 - 13:20:04 CST
![]() |
![]() |