Can I retrieve the serial number that was just inserted in Perl?

vetteguy

Diamond Member
Sep 12, 2001
3,183
0
0
I have a perl webpage that uses perl. The page executes a perl function that inserts a record into a database, which uses an auto-increment serial number for the record number. After the script has executed, I need to know what the serial number is of the record that was just inserted. I can't simply ask for the largest number, as I could have multiple people executing this page at once. My boss said he thought there was a perl function that can tell you what record number it just inserted, but he's not sure. Does anyone know of such a creature? Any help is appreciated.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
If the database is generating the serial number you'll have to read the docs for the DBD you're using and see if it'll get that for you.
 

JW310

Golden Member
Oct 30, 1999
1,582
0
0
Would it be possible to query the database for one of the values inserted into the database, and then get the serial number from that? Without knowing what database you're using, it's tough to give much more help.

JW
 

vetteguy

Diamond Member
Sep 12, 2001
3,183
0
0
It's an Informix database. Unfortunately, none of the values are necessarily unique except the serial number. I'm timestamping it with a year-to-second value, but there is still the possibilty of having duplicates.