Personal tools
You are here: Home DB2 How To's How to get all identity values generated by insert on DB2
Navigation
Log in


Forgot your password?
 
Document Actions

How to get all identity values generated by insert on DB2

final table clause


Use the clause final table in your insert statement, see the example below:

create table table_identity (cod1 int not null generated always as identity, cod2 int, cod3 int);

select * from final table (insert into table_identity (cod2,cod3) values (20,20),(30,30));

COD1        COD2        COD3

----------- ----------- -----------

          1          20          20

          2          30          30


  1 record(s) selected.


Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls