I'm thinking dynamic SQL is your friend here. Understand that you typically
avoid but sometimes the correct tool really is a left-handed monkey wrench.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Jonathan Mason
Sent: Tuesday, October 20, 2015 1:19 AM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL Pre-compiler Issue

All

We have a problem with an embedded SQL RPG program that he is writing. The
program uses an ALTER TABLE to add columns to an existing table and then
uses an UPDATE to populate them. The problem is that the UPDATE statement
is kicking out an error as the pre-compiler doesn't recognise the new
columns as belonging to the table at the time of the update.

If he can set the GENLVL to 31 to get past the pre-compiler error, but then
the RPG compiler fails as the generated CLI code is incorrect.

We know that we can code the statement dynamically to get round the issue,
but as a rule we try to avoid dynamic SQL. My question is, should this be
something the pre-compiler ought to be able to deal with or should we be
looking at using dynamic SQL or splitting the program into two?

Thanks
Jonathan


________________________________
Proud partner of The Ageas Bowl and the Ageas Salisbury International Arts
Festival.

Registered Address: Ageas House, Hampshire Corporate Park, Templars Way,
Eastleigh, Hampshire, SO53 3YA Registered Number: 354568 England

Authorised by the Prudential Regulation Authority and regulated by the
Financial Conduct Authority and the Prudential Regulation Authority

This e-mail together with any attachments are intended for the addressee
only and may be private and confidential. If you are not the intended
recipient, or the person responsible for delivering it to the intended
recipient, you must not open any attachments, or copy, disclose, distribute,
retain or use this e-mail, including any attachments, in any way whatsoever;
please return it to us immediately using the reply facility on e-mail.

Consider the environment and think before you print this email.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.