|
Big thanks, this seems to be exactly what I need. El Thursday 19 August 2004 17:16, rob@xxxxxxxxx escribió: > http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/info/db2/rbafzmstscale.htm#scaidentity > Examples > Set the variable IVAR to the value assigned to the identity column in the > EMPLOYEE table. The value returned from the function in the VALUES > statement should be 1. > CREATE TABLE EMPLOYEE > (EMPNO INTEGER GENERATED ALWAYS AS IDENTITY, > NAME CHAR(30), > SALARY DECIMAL(5,2), > DEPT SMALLINT) > > INSERT INTO EMPLOYEE > (NAME, SALARY, DEPTNO) > VALUES('Rupert', 989.99, 50) > > VALUES IDENTITY_VAL_LOCAL() INTO :IVAR > > > Rob Berendt > -- > Group Dekko Services, LLC > Dept 01.073 > PO Box 2000 > Dock 108 > 6928N 400E > Kendallville, IN 46755 > http://www.dekko.com > > > > > > Raul Jager <raul@xxxxxxxxxx> > Sent by: rpg400-l-bounces@xxxxxxxxxxxx > 08/19/2004 04:05 PM > Please respond to > RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> > > > To > RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> > cc > > Fax to > > Subject > Identity value > > > > > > > I have a table with an identity column defined as: > N_OPAGO dec(7, 0) GENERATED ALWAYS AS IDENTITY PRIMARY KEY, > It work beutifull. My problem is that I need to update another table > using > the generated value. How can I retrieve it? > > I was tihnking on "select" using some of the values just inserted, but I > belive there is a more elgant method. Trouble is, I could not find it. > > Can somebody give me a hint? > TIA > Raul > > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > > > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com 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.