Arrays of cursor variables
Posted in 1997
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
We are trying to port some Informix ESQL/C code to Oracle ProC and have run into the following problem: we can't seem to define and declare arrays of cursor variables in ProC in the same way. I have attached the Informix ESQL code. Does anyone know how to do this in Oracle or any workarounds? main() { ;;;;; for(i=0; i< numcols; i++) { sprintf(sql,"SELECT col%i FROM %s",colnum,tbl_name ); EXEC SQL PREPARE exprSel from :sql; sprintf(exprCur[i], "expCur%d", i); EXEC SQL DECLARE :exprCur[i] CURSOR FOR exprSel ; FREE :exprSel; EXEC SQL OPEN :exprCur[i] ; } DONE=FALSE; while(!DONE) { datap=databuff;*datap=NULL; colp=colbuff;*colp=NULL; for (i=0; i<numcols; i++) { EXEC SQL FETCH :exprCur[i] INTO :mydata; colp = colp + sprintf(colp,",col%d",i); datap = datap + sprintf(datap,",%d",mydata); } sprintf(sql,"insert into %s(name %s) values('xx' %s)",...); EXEC SQL execute immediate :sql; } /* loop to free cursors */ FREE :exprCur[i]; }