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

Home -> Community -> Usenet -> c.d.o.server -> a CLOB as an OUT parameter with OCCI

a CLOB as an OUT parameter with OCCI

From: flopbucket <flopbucket_at_hotmail.com>
Date: Mon, 09 Jul 2007 17:26:01 -0000
Message-ID: <1184001961.944163.71900@w3g2000hsg.googlegroups.com>


Hi,

I'm having a bit of trouble trying to call a stored procedure that has a CLOC as an out paramter. The procedure is defined as:

PROCEDURE GET_DATA(xmldata OUT nocopy clob)

My simple OCCI test code is:

	try

{
Environment *env = Environment::createEnvironment(); Connection *conn=env->createConnection("user", "password", "server"); std::cout << "created connection" << std::endl; Statement *stmt = conn->createStatement(); std::cout << "created statement" << std::endl; stmt->setSQL("BEGIN GET_DATA(:1); END;"); stmt->registerOutParam(1, oracle::occi::OCCICLOB, sizeof(Clob)); std::cout << "about to execute statement" << std::endl; stmt->execute(); std::cout << "executed" << std::endl; Clob clob = stmt->getClob(1); std::cout << "got clob" << std::endl; clob.open(); std::cout << "got stream, length is " << clob.length() << std::endl; unsigned char buf[4096]; clob.read(4000, buf, 4000); std::cout << buf << std::endl; } catch(const SQLException& ex)
{
std::cout << ex.getErrorCode() << ": " << ex.what() << std::endl; std::cout << "ex type is " << typeid(ex).name() << std::endl; }

It runs and throws an exception inside the stmt->getClob(1). The exception is strange though, it gives error code 3001 and the text says "normal, successful completion" - but obviously it's not.

One possible thing, I'm not sure what to pass for the length of a CLOB out parameter in registerOutParam(), I tried a few different things but none seem to make any difference.

I can't seem to find any examples of a CLOB as an out parameter using OCCI. Thanks for any tips. Received on Mon Jul 09 2007 - 12:26:01 CDT

Original text of this message

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