× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

You need to distinguis between VALUES and VALUES INTO (what Charles used!)

Values into:
The values into statment produces a result table consiting of at most one
row and assigns the values in that row to variables.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Rick.Chevalier@xxxxxxxxxxxxxxx
Gesendet: Wednesday, November 05, 2008 20:11
An: rpg400-l@xxxxxxxxxxxx
Betreff: RE: Retrieving identity column value when adding a record



Thanks to everyone who replied.

I forgot to mention that we are at V5R4 so I can't get the value from an
insert statement.

I just want to clarify something. I saw Charles solution from the archives.
When I looked it up in the SQL reference manual it specifically states the
VALUES statement is only allowed in a trigger. I am not using a trigger and
doubt that will change. Is the manual wrong and the statement can be used
from a SQLRPGLE program?

From the V5R4 SQL reference manual:
VALUES

The VALUES statement provides a method for invoking a user-defined function
from a trigger. Transition variables can be passed to the user-defined
function.

Invocation
This statement can only be used in the triggered action of a CREATE TRIGGER
statement.


Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Charles Wilt
Sent: Wednesday, November 05, 2008 11:18 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Retrieving identity column value when adding a record

Use:
VALUES IDENTITY_VAL_LOCAL() INTO :IVAR

HTH,
Charles

Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.