Yes, you do not use a select into... you use a select, and you need to use the SQLDA for the description of the variable and the extraction of the returned value.

Fleming, Greg (ED) wrote:
To partially answer my own question, that can't possibly make any sense.

It is trying to substitute the value of :w_Count in the prepare
statement, which isn't what I want. W_Count is the output variable I
want to receive the count in. I'm beginning to conclude that it is in
fact not possible to use dyanamic SQL with a "select into" statement.
Please correct me if that is not true.
Since there are only four possible values for my file name, I have
resorted to a select:

Select:
When p_File = 'MKCUSW';
Exec SQL Select count(*) into :w_Count From MKCUSW;
When p_File = 'MKPRODW';
Exec SQL Select count(*) into :w_Count From MKPRODW;
When p_File = 'MKOHLW';
Exec SQL Select count(*) into :w_Count From MKOHLW;
When p_File = 'MKPROMOW';
Exec SQL Select count(*) into :w_Count From MKPROMOW;
EndSL;
If there's a niftier way to do this, do tell.
Thanks

Greg
|
|<snip>
|W_SQLString = 'select count(*) into ? From ' + %trim(w_FileName);
|Exec SQL Prepare w_SQLStmnt from :w_SQLString;
|Exec SQL Execute w_SQLStmnt using :w_Count;
|</snip>
|
|The string in debug reads "select count(*) into ? From MKCUSW".
|But now the prepare statement throws a "token not valid".
|
|Am I getting closer ? Will dynamic SQL even work with a "select into" ?
|



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.