Howdy All,

I've got a table that was created via an SQL statement that looks like this:
(hdrheadkey integer not null
generated always as identity
(start with 1
,increment by 1
,no maxvalue
,no cycle
,hdrdate numeric(8,0) not null default 0
,hdrtime numeric(8,0) not null default 0
,hdruser char(10) ccsid 37 not null default ''
,hdrcaption char(4) ccsid 37 not null default ''
,hdrdesc char(40) ccsid 37 not null default ''
,hdrinsname char(60) ccsid 37 not null default ''
,hdrsubject char(60) ccsid 37 not null default ''
,primary key (hdrheadkey));
I need to get the key that is created when an insert is done and this is what I've pulled from a sample from a DB2 Cookbook but I'm getting an error in WDSc when trying to enter it:
 Exec SQL    Select HDRHEADKEY       InTo :HeaderKeySQL0199 Keyword TABLE not expected. Valid tokens: FOR WITH FETCH ORDER UNION EXCEPT OPTIMIZE        ValuesEnd-Exec

Am I trying to do something that can't be done?  Is there another way to get the newly created key from an insert to be used in another table?

I love deadlines. I like the whooshing sound they make as they fly by.
    Douglass Adams          (:NoteDate, :NoteTime, :NoteUser, ' ', :InsuredName, ' '))          (HdrDate, HdrTime, HdrUser, HdrCaption, HdrDesc, HdrInsName, HdrSubject)         (Insert InTo NotePadHd       From Final Table table notepad/notepdhd

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.