jseymour@LinxNet.com (Jim Seymour) wrote :
> Define what you mean by "with a script." If you've a db handle open
> with, say, Perl's DBI, you could simply do a select on currval() for
> the sequence and get it. This is immune to other transactions.
Indeed, I'm using Perl's DBI. currval does exactly what I want. Thanks to
all who pointed it to me.
Before I could read your messages, I made a workaround that worked nice also,
but could you tell me if it would always work ?
It uses the "oid" number. I've read that it used to be unique, but within
the same session, I can assume that it is always growing, can't I ?
INSERT into A VALUES (DEFAULT, "toto");
INSERT into B VALUES (
(SELECT id FROM A WHERE oid = SELECT ( max(oid) from A)),
"toto");
--
Florence HENRY
florence point henry arobasse obspm point fr