Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: HOW TO SELECT LATEST INSERTED ROW..
>-----Original Message-----
>From: Saurabh Sharma [mailto:saurabhs_at_fcsltd.com]
>Sent: mercredi, 21. février 2001 02:15
>
>how can i select the latest inserted row from a table.
>i want to select a col value, perform some operation on it and update
> the same to table via a trigger..
>it says table is mutating.
>i'm inserting rows 1 at a time.
Here is an example of a trigger that sets a date field to be the insert date. Are you trying to do something similar to this?
SQL> create table t (n number, d date) ;
Table created.
SQL> create trigger t_bfi before insert on t for each row
2 begin 3 :new.d := sysdate ; 4 end ; 5 /
Trigger created.
SQL> insert into t (n) values (1) ;
1 row created.
SQL> select * from t ;
N D
---------- ---------
1 21-FEB-01