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 -> Re: CLOB as out parameter, OCCI

Re: CLOB as out parameter, OCCI

From: <fitzjarrell_at_cox.net>
Date: Mon, 09 Jul 2007 11:20:57 -0700
Message-ID: <1184005257.860433.305350@d55g2000hsg.googlegroups.com>


On Jul 9, 12:27 pm, flopbucket <flopbuc..._at_hotmail.com> wrote:
> 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.

Crossposting doesn't get a faster response.

Could you post the DDL for this procedure you've created?

David Fitzjarrell Received on Mon Jul 09 2007 - 13:20:57 CDT

Original text of this message

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