Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> executing procedure with CLOB parameter from C
Hi,
i'm trying to execute PL/SQL procedure from C using OCI. database: oracleDB 9.2
That procedure has one parameter, CLOB,
and the question is, how to transfer that CLOB to procedure.
I have the following piece of code (assuming that handles are initialized):
--------cut
char select[] = "select MY_PACK.load_xml( :xml ) from dual"; char my_txt[] ="testing testing";
rc = OCIStmtPrepare(p_sql, p_err, (OraText*)select,
(ub4) strlen( select ), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
if( checkerr( p_err, rc ) != 0 )
return 1;
rc = OCIBindByName(p_sql, &p_bnd, p_err, (text *) ":xml", 4,
(dvoid **) my_txt, strlen(my_txt) , SQLT_CHR, (dvoid *) 0,
(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);
if( checkerr( p_err, rc ) != 0 ) return 1; rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, (dvoid *) &p_int,
(sword) 4, SQLT_INT, (dvoid *) 0, (ub2 *)0,
(ub2 *)0, OCI_DEFAULT);
if( checkerr( p_err, rc ) != 0 ) return 1; rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0,
(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
if( checkerr( p_err, rc ) != 0 ) return 1;
--------cut
in this way, my string is insterted, (conversion STR->CLOB occurs),
but for data larger that about 2k there is an error:
ORA-01460: unimplemented or unreasonable conversion requested
ok, that fine, i should use CLOB's from the beginning,
but how to do that?
how to use OCILOBLocator in 'select' clause ?
Do you have any idea? or pieco of example code ?
-- best regards, lukesReceived on Mon May 16 2005 - 05:54:33 CDT
![]() |
![]() |