Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> a CLOB as an OUT parameter with OCCI
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
![]() |
![]() |