Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> A newbie question regarding cursors
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
![]() |
![]() |