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

Home -> Community -> Usenet -> c.d.o.server -> A newbie question regarding cursors

A newbie question regarding cursors

From: peckle <peckle_at_pacific.net.sg>
Date: 20 Jul 1998 10:09:26 GMT
Message-ID: <01bdb3c6$428f0e50$64010a80@griffon>


Hi!

I'm a newbie who need to write some codes in C++ with dynamic SQL. I have to do the following in my program :

.....// fill the sql_statement.....
.....
EXEC SQL PREPARE S FROM :sql_statement; EXEC SQL DECLARE C CURSOR FOR S;
EXEC SQL OPEN C;
.....//prepare the descriptor select_dp .....
EXEC SQL FOR :array_size FETCH C USING DESCRIPTOR select_dp; EXEC SQL CLOSE C;
......

I HAVE TO separate the codes into a few function for some reasons : eg.
void prepare_sql()
{

   EXEC SQL PREPARE S FROM :sql_statement;    EXEC SQL DECLARE C CURSOR FOR S;
   EXEC SQL OPEN C;
}

void fetch_data()
{

   EXEC SQL FOR :array_size FETCH C USING DESCRIPTOR select_dp; }

Question: How do I declare the cursor such that it would not be out-of-scope after the prepare_sql() function.

Any help will be much appreciated.
Thank-you in advance.
Peck Leng Received on Mon Jul 20 1998 - 05:09:26 CDT

Original text of this message

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