Re: Getting last serial
Posted in 1999
Here's a trick. Try creating an insert trigger on the table in question and have that trigger pass the serial column value to a stored procedure. That stored procedure would simply set the value of a global variable (type = integer) and then return. Another stored procedure can be called to retrieve the value of that global variable. You could also wrap this entire mechanism within a master insert stored procedure which would accept a parameter for each column for that bale and be able to return the value after it performs the insert. Regards, bc H-C-I Administration wrote in message <7ak40b$989$3@news2.btconnect.com>... >Hi David, > >I am not sure if there is any other way in esql, I have checked the get >diagnostic stuff and cant see anything. > >You could requery the database to bring your row back and get the number. > >Regards > > >Sean > >@Syntegra.Bt.Co.Uk <@Syntegra.Bt.Co.Uk> wrote in message ><7ajvvu$snh$1@pheidippides.axion.bt.co.uk>... >>Hi - a question from a newbie Informix developer. >> >>I'm writing some ESQL/C programs and I'd like to know if there's >>any other way of getting the value of any SERIAL value generated >>on the last insert other than using sqlca.sqlerrd[1]. >> >>The reason for this is that, if possible, I'd like to avoid the using >>the sqlca and use the SQLSTATE variable instead. >> >>Thanks >> >>David Poulet >>-- >>David Poulet >>Software Developer, Syntegra, U.K. >>david.poulet@syntegra.bt.co.uk >> >> > >