Hi,
I'm trying to use dynamic pl/sql in a pro*C application (environment = HPUX Oracle 9i), and am encountering problems when I try to use cursors. Evidently it IS possible to use cursors in this way - after googling I found several examples which provided the foundation for my efforts.
The syntax works fine for a standard, non-cursor approach:
but fails for the cursor approach (utilizing the exact same connection logic as in the above example - in fact the programs are nearly identical):
When this second version is run, I receive an
error message.
What is it about this usage of a cursor that results in a "not logged on" error message?
Thank you!!! this really has me stumped at work, and
those darn deadlines are closing in...
dora c
I'm trying to use dynamic pl/sql in a pro*C application (environment = HPUX Oracle 9i), and am encountering problems when I try to use cursors. Evidently it IS possible to use cursors in this way - after googling I found several examples which provided the foundation for my efforts.
The syntax works fine for a standard, non-cursor approach:
Code:
char myQuery[80] = "select count(*) from all_tables";
...
EXEC SQL AT sa_db_name
BEGIN
EXECUTE IMMEDIATE :myQuery INTO :iCount;
END;
END-EXEC;
but fails for the cursor approach (utilizing the exact same connection logic as in the above example - in fact the programs are nearly identical):
Code:
char myQuery[80] = "select table_name from all_tables";
...
EXEC SQL PREPARE S FROM :myQuery;
EXEC SQL DECLARE C CURSOR FOR S;
EXEC SQL OPEN C;
EXEC SQL WHENEVER NOT FOUND DO break;
for (iCounter = 0; iCounter < 10; iCounter++) {
EXEC SQL FETCH C INTO :output;
printf("data is: .%s.\n", output);
}
When this second version is run, I receive an
Code:
ORA-01012: not logged on.
What is it about this usage of a cursor that results in a "not logged on" error message?
Thank you!!! this really has me stumped at work, and
those darn deadlines are closing in...
dora c