My two cents is that changing tables on the fly points to dynamic SQL. It's not that the pre-compiler doesn't recognize the columns at the time of UPDATE, it doesn't recognize them at the time of COMPILE.



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?


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.

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-2021 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.