Cursors and Pro*C
From: Wade Tsai <ep60wtu_at_noh71fb.shell.com>
Date: Fri, 4 Nov 1994 21:05:12 GMT
Message-ID: <CyrH8p.sB_at_shellgate.shell.com>
}
Date: Fri, 4 Nov 1994 21:05:12 GMT
Message-ID: <CyrH8p.sB_at_shellgate.shell.com>
/*-------- BEGIN PSEUDO-CODE --------------*/
int ORA_ReadFunc(blah blah blah)
{
/* ... Local var decls here ... */
EXEC SQL DECLARE datacursor CURSOR for sql_stmt;
EXEC SQL OPEN datacursor;
EXEC SQL WHENEVER NOT FOUND GOTO EndRead;
EXEC SQL DESCRIBE SELECT LIST FOR datacursor INTO qdptr;
/* ... Some intermediate code here... */
/* Fetch loop. */
while (!done) {
EXEC SQL FETCH datacursor USING DESCRIPTOR qdptr; rtsval = (*ProcessRow)(qdptr,cdata,sqlca.sqlerrd[2]); switch (rtsval) { case STAT1: /* NOP */ break; case STAT2: if ((pid = fork()) < 0) { /* error */ } else if (pid == 0) { /* Child. Build new query and submit it. */ return(ORA_ReadFunc(blah blah blah)); } else { /* Parent */ waitpid(pid,&status_val,0);
/* >>> Child ran ok... continue processing cursor contents <<< */
} break; /* ... More code here ... */ }
}
/* ... Clean up code here ... */
return(some_int_stat_value);
}
/*----------- END OF PSEUDO-CODE --------------*/
Will Oracle be confused as to which cursor the child is referring to?
Also, how does Oracle Corp. define a session to be? A login or a process?
ANY help/suggestions/pointers would be MUCH appreciated!
-- Wade Tsai ------------------------------------------------------------------------------- Shell Oil Company, 3-D CAD Group ep60wtu_at_shell.com, (504)-588-6642 My opinions are purely ficticious and does not reflect the opinions of any person living, past or present. Any reflection of the opinions of either the Shell Oil Company or Digital Consulting is purely coincidental. And boy, what a freakin' coincidence THAT would be! -------------------------------------------------------------------------------Received on Fri Nov 04 1994 - 22:05:12 CET