Hints and tricks for developers

Martins Amazon Wunschliste

DB2 – retrieve generated id 9. July 2012

If you what to know the which ID was given to a record after an insert .

Record successfuly save with id: 815

e.g. insert into mytable (col1, col2, col3) values ( ‘val1’,  ‘val2’, ‘val3’);

just calll

values identity_val_local();

it will return the last generated id.

e.g. 2

No Comments on DB2 – retrieve generated id
Categories: Uncategorized
Martin Rocks