Getting ID of inserted record regardless of sequence
728400Oct 16 2009 — edited Oct 19 2009Hello,
I have a problem finding out how to do this. Maybe someone here will know?
I have class who contain a method which executes insert and update statements. The class returns the ID of the newly inserted record regardless of the table.column name. I can do this with @@identity because I am currently on an MS Access database.
Oracle is another matter. I have figured out that a sequence will give me the nextVal just before I insert the new record so I can have the next ID added in the insert. But how do I write a query that returns the ID of the inserted record regardless of the sequence name? Is it impossible to do that?
Basically I have a function which takes an SQL-string as argument and which returns the ID of the record to be added:
intID = execQuery(strSQL)
Something that makes the matter worse is that the ID column is called something different in every table.
Mattias