Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Passing a pointer to a cursor variable between 2 pro*c functions.

Passing a pointer to a cursor variable between 2 pro*c functions.

From: Paul Sehgal <psehgal_at_nortelnetworks.com>
Date: Fri, 20 Aug 1999 14:38:15 +0100
Message-ID: <37BD5A47.41FB7BDD@nortelnetworks.com>


Hi,
  I have created the following 2 pro*c functions:

DPLsearchNCustomers( ... sql_cursor *p_cursor...) ;

DPLcloseCursor(sql_cursor *p_cursor) ;

 The first function allocates memory for the cursor variable and open the
cursor. The second function closes the cursor. however when I call the second function to close the cursor I get the following error message: ORA-01001 : Invalid Cursor.

I don't do a commit between the function calls and I have checked my SGA to
ensure the cursor is still there before I close it with the second function.

The following text is DPLclosecursor(sql_cursor *p_cursor);

DPLcloseCursor(sql_cursor *p_cursor)
{
#include <sqlca.h>

EXEC SQL BEGIN DECLARE SECTION ;   sql_cursor *c_cursor = p_cursor;
/*other variables are declared here*/
 

EXEC SQL END DECLARE SECTION ;      EXEC SQL EXECUTE
    BEGIN     

       IF :c_cursor%ISOPEN = TRUE THEN
         CLOSE :c_cursor ;
       ELSE
        /*other statements are here*/
       END IF ;

    END ;
  END-EXEC ;   if (sqlca.sqlcode != 0) { // Error occured Locally.     return(DPLsqlError(sqlca.sqlcode)) ;   }
/*return statement located here*/

} Received on Fri Aug 20 1999 - 08:38:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US