[thelist] Free Tip about SQL

Plunkett, Matt MPlunkett at MSA.com
Fri Jul 18 11:24:50 CDT 2003


My syntax was a lil off...corrected below.

-----Original Message-----
From: Plunkett, Matt 

>>A colleague of mine came up to me and asked:
"Is there a way, in a SQL statement, to return the auto generated ID of a
record when it's created by an insert values query? ..."

In PL/SQL, you can just do: 

INSERT INTO tablename (..) VALUES (...) RETURNING idcol INTO varname.  

I would imagine most languages have a built in technique for doing this.


More information about the thelist mailing list