× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



That's because he's expecting w1 to have the result of the SQL statement.

On Mon, Dec 8, 2014 at 12:25 PM, Sam_L <lennon_s_j@xxxxxxxxxxx> wrote:

1) I don't see w1 set anywhere (probably a paste failure).
2) I recommend you check SQLSTT of SQLCOD after exec sql statements. You
may find that your prepare failed and that will help you track down the
problem.

Sam

(Note that declare cursor and set statements don't set SQLSTT or SQLCOD.)

On 12/8/2014 10:26 AM, Billy Waters wrote:

My first attempt at using dynamic SQL. Any help would be greatly
appreciated.

w2 = 'R1';
w3 = 'R9';
w4 = 2015;
w5 = 4;

WSQL = 'select sum(pinv) into ? from CMSFWRK20 ' +
'where PCLS between ? and ? ' +
'and PYEAR = ? and PPERD = ?';
Exec Sql prepare S1 from :WSQL;

Exec SQL
execute S1 using :w1, :w2, :w3, :w4, :w5;

job log shows
call test
Token ? was not valid. Valid tokens: : <IDENTIFIER>.
Prepared statement S1 not found.


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com


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