SAP Knowledge Base Article - Preview

2390998 - How to use cursors correctly in IQ - SAP IQ

Symptom

If an IQ stored procedure used a cursor, and the cursor were opened without option "WITH HOLD", the stored procedure could return an uncertain resultset :

  • When executing the IQ stored procedure in client utility "isql" (by default, the transaction mode in "isql" is unchained mode --"AutoCommit" on) or user applications which have no transaction control (set "AutoCommit" on, implicit "commit" will be executed immediately after each SQL statement automatically), the returned resultset would be incomplete, only the first row of the expected resultset could be returned;
  • But when executing the same procedure in client utility "dbisql" (by default, the transaction mode in "dbisql" is chained mode --"AutoCommit" off)  or user applications which have good transaction control (set "AutoCommit" off, need to use explicit "begin tran ... commit" to commit a transaction), the complete resultset could be returned.
  • If there were some data definition statement (DDL command) in the loop body of the cursor, no matter in "isql","dbisql" or user applications, the stored procedure would only return the first one or few rows of the expected resultset, all data rows which should be read out after the DDL command would be lost.


Read more...

Environment

  • SAP IQ 16.1
  • SAP IQ 15.4

Product

SAP IQ 16.0

Keywords

Sybase, IQ, COMMIT, TRANSACTION, CLOSE CURSOR, implicit commit, unchained transaction mode, chained transaction mode, with hold , KBA , BC-SYB-IQ , Sybase IQ , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.