Sequence number after insert


As long as the trigger only processes ONE row (eg: you never "insert into T select * from some_table_with_more_then_one_row") you can simply:

select s.currval from dual

in your application to find the last value used in the INSERT. This is because the 'currval' value can be retrieved on a session-by-session basis (as long as it least one retrieval from the sequence has been done as is the case here)

Additionally, with Oracle8.0 and up you can code:

insert into t ( ... ) values ( .... ) 
returning NV into :some_variable;
to get the assigned value back.