Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> ansi dynamic sql returning clause
Hello,
can anybody explain how to use dynamic sql return clause in proc,
please ?
I use the following code snippets;
/* Table */
create table test1 (cl clob);
char *stmt="insert into test1 (cl) values(empty_clob()) returning cl :into clob";
EXEC SQL ALLOCATE DESCRIPTOR 'ind';
EXEC SQL ALLOCATE DESCRIPTOR 'ond';
EXEC SQL Allocate :clob;
printf("Prepare STatement");
EXEC SQL PREPARE stmt FROM :stmt;
printf("\n");
printf("DECLARE CURSOR");
EXEC SQL DECLARE c CURSOR FOR stmt;
printf("\n");
printf("DescrInput");
EXEC SQL DESCRIBE INPUT stmt USING DESCRIPTOR 'ind'; //ohne For
printf("\n");
printf("DescrOutput");
EXEC SQL DESCRIBE OUTPUT stmt USING DESCRIPTOR 'ond'; //ohne For
printf("\n");
printf("GetCount Input ");
EXEC SQL GET DESCRIPTOR 'ind' :countin= COUNT;
printf("\n");
printf("GetCount Output ");
EXEC SQL GET DESCRIPTOR 'ond' :countout= COUNT;
printf("\n");
printf("Count Input %d\n",countin); /* Gives 1 ? */
/***** Should it be 0 ? ***/
printf("Count Output %d\n",countout); / Gives 0 */
/**** Should it be 1 ? ***/
printf("Execute");
EXEC SQL FOR BATCHFETCH EXECUTE stmt USING DESCRIPTOR 'ind' into
DESCRIPTOR 'ond';
printf("\n");
The Execute statement returns an ORA-00932 inconsistent datatypes
Thanks Received on Fri Jan 18 2002 - 09:53:33 CST