> > -----Original Message-----
> > John Boucher [mailto:[EMAIL PROTECTED]] wrote:
> >
> > It seems to me that the reason you can't have the ID of the last
> inserted
> > row automatically returned in a variable is that some (most?) databases
> > allow INSERT to insert more than one row at a time.
> > This would affect auto-increment as well.
> >
> > Sure, you may only be inserting one row _now_, but what about
> > the times when someone inserts many?
(a) Typically, in the scenario described, there is only one row inserted --
it is a INSERT INTO table VALUES(...) statement rather than an INSERT INTO
table SELECT statement.
(b) If you are using DBD::Informix, then the answer you are seeking is in
$sth->{ix_sqlerrd}[1] after you execute the INSERT statement. It would give
you the last value generated in the case of a multi-row insert.
--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED])
Guardian of DBD::Informix 1.00.PC2 -- see http://dbi.perl.org/
#include <disclaimer.h>