467,887 Members | 1,550 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,887 developers. It's quick & easy.

How to get generated key back in php/db2 v8.1.9 Linux

I am doing an insert into a table with a generated key. How do I obtain
the generated key of the record I just inserted?
Mar 22 '06 #1
  • viewed: 1401
Share:
3 Replies
Try

select gen_key from final table(insert into your_table (columns) values
(values))

That is, select the generated key as part of the insert statement.

I really, really like that feature.

-Chris

Mar 22 '06 #2
Chris wrote:
Try

select gen_key from final table(insert into your_table (columns) values
(values))

That is, select the generated key as part of the insert statement.

I really, really like that feature.

-Chris

Thank you very much. No doubt it is implied by the fine manuals, but I
sure didn't find it in the *[Ii]dent* samples in the samples directory.
Mar 23 '06 #3
The manuals aren't perfect either. IMNSHO, you need to know what you
are looking for.

Although, one thing about is really nice. It lists possible error codes
when using bad parameters.

B.

Mar 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Headless | last post: by
14 posts views Thread by Jim Hubbard | last post: by
2 posts views Thread by Brooks Clayton | last post: by
10 posts views Thread by shaanxxx | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.