Bug 2544

"Cursor has not been declared" error 20 November, 2020

Meditab Meditab
30 March, 2019
Product: PowerBuilder Category: Database
Version: 2017 R3 Build:
Classification: Publishing: Public
Priority: P1
Status: Verifying Reason:
Ken Guo @Appeon 20 November, 2020
#3
Hi Meditab,

I would like to check with you if the response provided has been helpful enough
to resolve your case. If so, can we proceed to close the ticket?
Otherwise, do let us know if we can provide you with any further assistance and
keep in mind that you are always welcome to open another ticket in case you
need it.

Regards,
Ken
Ken Guo @Appeon 01 April, 2019
#2
Hi Meditab,

Firstly, could you please tell me after you execute the procedure, what are the values of sqlca.sqlcode and sqlca.sqlerrtext?
Secondly, please tell me what is the Declare Procedure code. Does the code have brackets? If yes, please delete them.
For example:
DECLARE sp_test PROCEDURE FOR sp_syntax_test (:as_value , :ai_value2);
should be changed to
DECLARE sp_test PROCEDURE FOR sp_syntax_test :as_value , :ai_value2;

If the issue still exists, please provide a complete case for us. Thanks in advance.


Regards,
Ken
Meditab Meditab 30 March, 2019
#1
dberror.png (3KB)

*Phenomenon:
When we migrated our code to PB17, we had issues while calling the procedure through code. We got to know that we will have to add ",PBNewSPInvocation='yes'" at the end of SQLCA.DBPARM before connecting to database. After doing this, when I run my code, it calls a procedure which returns sqlcode as 109 and then the powerbuilder interprets it as sqlstate = 24000 and throws an error "Cursor has not been declared."

*Reproduce Steps:
1. In the connection string, add ",PBNewSPInvocation='yes'" at the end of SQLCA.DBPARM before
connecting.
2. Call any procedure through code which returns sqlcode as 109 (write any select query in the procedure that uses aggregate function on a column which has NULL values)
3. After executing that procedure through the code, check for the SQLCA.sqlcode in the immediate next line after execution of the procedure. If that equals -1 then prompt a message box with its text as SQLCA.sqlerrtext. 
4. A prompt will appear stating "Cursor has not been declared."

Remarks:
Since SQLCODE 109 is an alert, not an error. Therefore, the PowerBuilder should not treat it as an error. This error "Cursor has not been declared" should not pop up.
OS:
All
Platform:
All
Database Type:
Sybase
Database Version:
Sybase 17