sql - Informix: how to get an id of the last inserted record -
what's efficient way of getting value of serial column after insert statement? i.e. looking way replicate @@identity
or scope_identity
functionality of ms sql
the value of last serial insert stored in sqlca record, second entry in sqlerrd array. brian's answer correct esql/c, haven't mentioned language you're using.
if you're writing stored procedure, value can found thus:
let new_id = dbinfo('sqlca.sqlerrd1');
it can found in $sth->{ix_sqlerrd}[1]
if using dbi
there variants other languages/interfaces, i'm sure you'll idea.
Comments
Post a Comment