Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Reading clobs from external c procedure called from PL/SQL
Found it, I somehow forgot to initialise 'amtp' before the call to
OCILobRead().
> I have problems reading clobs from Oracle 8.1.7.
>
> In a session, the first call to OCILobRead() will work.
> All OCILobRead() calls after that will only read up to the
> length of the first read clob within that session.
>
> ___CUT___
> plain=(char*)malloc( (long)lenp +1 );
> memset ((void *)plain, '\0', (long)lenp+1);
>
> // read the clob until no more data is available
> do{
> err = OCILobRead(svchp, errhp, lobplain, &amtp, offset,
> (dvoid *) (plain+offset-1), (ub4)lenp , (dvoid *) 0,
> NULL, (ub2) 0, (ub1) SQLCS_IMPLICIT);
>
> if (err == OCI_SUCCESS || err == OCI_NEED_DATA){
> offset +=amtp;
> }
>
> } while (err == OCI_NEED_DATA);
>
> ___CUT___
>
Received on Fri Feb 08 2002 - 05:16:56 CST