Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Pro*C & changing cursornames
Here is my code snippet:
static varchar stmt [80] ; /* prepare statement storage */
stmt.len = sprintf ((char *) stmt.arr, "grant DSC_ENG_ECM to %s",
(char *) oracle_id.arr) ;EXEC SQL PREPARE grant_stmt from :stmt ; EXEC SQL execute grant_stmt ;
Bert Vanderstraeten (bvds_at_hotpop.com) wrote:
: 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 empno
: FROM 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
--
While Alcatel may claim ownership of all my ideas (on or off the job),
Alcatel does not claim any responsibility for them. Warranty expired when u
opened this article and I will not be responsible for its contents or use.
Received on Tue Oct 19 1999 - 16:18:16 CDT