Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> executing procedure with CLOB parameter from C

executing procedure with CLOB parameter from C

From: lukes <razorjack_at_hihi.gazeta.pl>
Date: Mon, 16 May 2005 10:54:33 +0000 (UTC)
Message-ID: <Xns96588340C563Flukes@193.42.231.152>


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,
lukes
Received on Mon May 16 2005 - 05:54:33 CDT

Original text of this message

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