in reply to Re: Sequences, last_insert_id, SQLite, and Oracle
in thread Sequences, last_insert_id, SQLite, and Oracle
The way to handle this is to catch the sequence value that was actually used by the trigger, atomically as part of the insert statement itself. Oracle DOES IN FACT provide a way of doing PRECISELY THAT. You can write an insert statement like "insert into foo ... returning id into ?", and then use in/out binding (see DBI docs for bind_param_inout) to catch the value that is spit out into that trailing bind value.
This method works, reliably. It is easy enough. None of the other methods in this thread do work reliably.
------------ :Wq Not an editor command: Wq
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Sequences, last_insert_id, SQLite, and Oracle
by sharkey (Scribe) on Jun 17, 2005 at 04:28 UTC |