Re: Last Identity added

From: <sybrandb_at_yahoo.com>
Date: 4 Jun 2004 04:22:38 -0700
Message-ID: <a1d154f4.0406040322.54599916_at_posting.google.com>


yatuchabe_at_hotmail.com (Carlos San Miguel) wrote in message news:<b5abf2cd.0406031659.7e18ed17_at_posting.google.com>...
> Hi, I'm going to be using Oracle with a customer. I will access
> Informix with ODBC. All the tables have a serial column, this is the
> ID for the record. I need to know how I can get the value of the
> serial column for the last record inserted. A stored procedure maybe?
>
> TIA
> Carlos San Miguel

You could use the 'returning <column_name> clause' of the insert statement, if you run the insert inside a stored procedure. If you are using sequences for the id column (which you should do), you could have a stored procedure running select <sequence>.currval from dual;
only.

Sybrand Bakker
Senior Oracle DBA Received on Fri Jun 04 2004 - 13:22:38 CEST

Original text of this message