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 -> Pro*C & changing cursornames

Pro*C & changing cursornames

From: Bert Vanderstraeten <bvds_at_hotpop.com>
Date: Mon, 18 Oct 1999 19:59:49 +0200
Message-ID: <8iJO3.133$_L4.356@news-brussels.gip.net>

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 Received on Mon Oct 18 1999 - 12:59:49 CDT

Original text of this message

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