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



On 22 March 2016 at 18:13, Bruce Collins <bcollins@xxxxxxxxxxx> wrote:
Guys, I have been pulling my hair out with this and I hope you can help me with it.

Below is the code to an SQLRPGLE program and a stored procedure.

The program calls the Stored Procedure pass First and Last Name. The SP returns a result set. I am getting an SQL error SQL0504
Stating that I have not declared the cursor but it gets declared in the ALLOCATE statement. See below highlighted in yellow.

No HTML comes through the list, so no highlighting.

Dcl-S MyResultSet SQLTYPE(RESULT_SET_LOCATOR);

EXEC SQL CALL uspGetMatch(:ADFNAME, :ADLNAME); //Stored Procedure

Exec SQL
ASSOCIATE RESULT SET LOCATORS
(:MyResultSet)
WITH PROCEDURE uspGetMatch;

Exec SQL
ALLOCATE MYCURSOR CURSOR
FOR RESULT SET :MyResultSet;
Exec SQL
Open MYCURSOR;
SQL0504: Position 23 Cursor MYCURSOR not declared.

I have something like this but I don't do an OPEN.


call myproc
if sqlstate = sql_rs_returned
associate result set locators :myresultset
with procedure myprocedure

if sqlstate = sql_normal
allocate mycursor cursor for result set :myresultset

fetch next from mycursor into :mystruc

close mycursor

IBM i 7.2 TR3
--buck

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.