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



Hi,

does it work the first time you call the program?
Or does it never work?

If it works for the first time, try to close the cursor before reopening it.

What naming are you using?

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von MattLavinder@xxxxxxxxxxxxxxxxxxx
Gesendet: Thursday, 04. February 2010 22:57
An: rpg400-l@xxxxxxxxxxxx
Betreff: SQL Procedure - Set Schema ignored?



Not sure where the best group is for this, but it is embedded SQL in an RPG
program, so I am putting it here.

Trying to write an external stored procedure to retrieve data. First
parameter of the procedure is a customer identifier. Based on that
parameter, I use exec sql SET SCHEMA :custlib; to set the library to use,
Then I declare my cursor and proceed with the SQL Statement. Problem is,
it doesn't work. I have verified the custlib is correct, and even verified
the schema changed (see below). Regardless of what is written to my log,
it still seems to use the default schema when it runs the statement. Are
there options I need to change when I compile the RPG program, or is this
something that can't be done?

exec sql SET SCHEMA :custlib;

exec sql VALUES(CURRENT SCHEMA) INTO :CURSCHEMA;

WriteLog('CRMTASKLD3':curSchema);

exec sql DECLARE c1 CURSOR FOR
SELECT t.*, ifnull(typdesc,'') typdesc,.
ifnull(catdesc,'') catdesc, ifnull(dispdsc,'') dispdsc
FROM crmtask t
LEFT JOIN dmilibr.crmtypes st on t.tsktype = st.type
LEFT JOIN crmcats ut
on t.tskusrtype = ut.category
LEFT JOIN crmdisp ud
on t.tskdisp = ud.dispid
WHERE tskpgm = :pTskPgm
and tskpgmid = :pTskPgmid;

exec sql OPEN c1;


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.