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



Linda wrote:

I have an external stored procedure that calls an rpg program that builds a
dynamic select statement and am having a problem getting the result set
back.

Here's a synopsis of some working code:

build STATEMENT

exec sql close MBR_LIST;

exec sql prepare PREPARED_STATEMENT from :STATEMENT;
if (SQLSTATE <> SQL_NORMAL);
dump(a) 'prepare()';
return;
endif;
exec sql declare MBR_LIST scroll cursor for PREPARED_STATEMENT;

exec sql open MBR_LIST;
if (SQLSTATE <> SQL_NORMAL);
dump(a) 'open()';
return;
endif;

exec sql
set result sets for return to client
cursor MBR_LIST;

return;


CREATE PROCEDURE mylib/myproc(
IN firstName VARCHAR ( 27),
IN lastName VARCHAR ( 25),
...)
RESULT SETS 1
LANGUAGE RPGLE
NOT DETERMINISTIC READS SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME mylib/mypgm
PARAMETER STYLE GENERAL WITH NULLS

Some judicious DUMP operations can sometimes help isolate the issue, and don't forget to check SQLSTATE after every executable SQL statement!
--buck

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