|
Thank you. That is VERY helpful. Next, regarding the WHERE clause. *IF* I have just "selected" the record, and displayed it, and changed something on it, do I need a WHERE clause? Won't I be updating the record I just retrieved? Thanks again, Dave -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx Sent: Thursday, November 30, 2006 10:06 AM To: RPG programming on the AS400 / iSeries Subject: Re: Doing a SET with variables First, you are missing a WHERE clause. You better have one. Dynamic SQL is great, but can impact performance. Be nice to see if you could do something like the following (which I haven't tried) (sample is V5R4) exec sql Update $AUDITSTG/SAVHISTORY case FileFieldValue<>:HostFieldValue Set FileFieldValue=:HostFieldValue ... where ...; But, if it doesn't and you continue to use "dynamic" SQL (suggested search words or important concepts are double quoted) then you'll need to do one of the following two solutions "PREPARE" a statement "EXECUTE" a statement or "EXECUTE IMMEDIATE" a statement like exec sql prepare stmt1 from :SelectTwo; exec sql execute stmt1; or exec sql execute immediate :SelectTwo; Rob Berendt
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.