Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Pro*C & changing cursornames
Hi,
I'm trying to get the following piece of code to work: It's a C-function that declares a cursor with a name based on a variable:
static void create_cursor ( )
{
EXEC SQL BEGIN DECLARE SECTION; varchar hv_dataname[ 21]; varchar hv_currstmt[500]; EXEC SQL END DECLARE SECTION; hv_dataname.len = sprintf( (char *) hv_dataname.arr, "%.20s", db ); hv_currstmt.len = sprintf( (char *) hv_currstmt.arr, "SELECT empnoFROM emp " );
EXEC SQL DECLARE db_stmt STATEMENT; EXEC SQL PREPARE db_stmt FROM :hv_currstmt;
==> EXEC SQL DECLARE cursorname CURSOR FOR db_stmt;
/* how can I use a variable name as cursorname in this last statement?
a :cursorname host variable does NOT work */
}
Thanks a million in advance!
Bvds
Received on Mon Oct 18 1999 - 12:59:49 CDT