|
On Thu, 2005-12-01 at 19:47 -0500, Michael Ryan wrote: > Why can't I do this? > > C/Exec SQL > C+ Select Sum(IOQTYO) > C+ Into :pWkQuan :WkNull > C+ From :MyFile > C+ Where IOITEM = :pWkItem And > C+ IOWHSE = 'PH' And > C+ IODELE <> 'D' > C/End-Exec > > Where MyFile is a variable. I get a "Token : was not valid. Valid tokens: ( > TABLE LATERAL <IDENTIFIER>." message. I don't think you can do this unless you use a cursor and define the entire statement in a variable. Here's a non-working example that might help you out: D my_host_data_structure... D D ds 7p 0 /free my_variable = 'select sum(iootyo) from ' + myfile + ' where ioitem = pwkitem; /end-free C/exec sql C+ declare my_statement from :my_variable C/end-exec C/exec sql C+ prepare my_cursor cursor using :my_statement C/end-exec C/exec sql C+ open my_cursor C/end-exec C/exec sql C+ fetch my_cursor into :my_host_data_structure C/end-exec C/exec sql C+ close my_cursor C/end-exec The info center has good docs on this nowadays. Search for prepared statements.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.