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 -> Re: problem with piecewise insert with oracle 8i

Re: problem with piecewise insert with oracle 8i

From: Daniel Morgan <damorgan_at_exesolutions.com>
Date: Sun, 09 Jun 2002 06:51:13 +0100
Message-ID: <3D02ECD1.C55793DE@exesolutions.com>


"Tilo Prütz" wrote:

> Hi!
>
> I have to write large binary data into a LONG RAW column. To avoid an out of
> memory error I tried the piecewise writing following the sample code and the
> Oracle documentation.
>
> Now my code does following:
>
> open statement:
> - OCIHandleAlloc
> - OCIStmtPrepare (update or insert with bind vars)
> - OCIBindByPos (with OCI_DATA_AT_EXEC for the LONG RAW column)
> - OCIStmtExecute
>
> write piece:
> - OCIStmtGetPieceInfo (to get the handle)
> - OCIStmtSetPieceInfo (to set piece size and buffer)
> - OCIStmtExecute
>
> close statement:
> - OCIStmtGetPieceInfo (because I don't know the EOD until I get a close
> message I write a zero length piece as OCI_LAST_PIECE)
> - OCIStmtSetPieceInfo
> - OCIStmtExecute
> - OCIHandleFree
>
> When running I insert som zero length columns, then one with 74 bytes, some
> with zero length, some with a length less 74 bytes again and then come 261
> bytes of data and an ORA-24307 (invalid length for piece).
>
> All I've found out is, that no data larger than the first one can be
> inserted.
> All commands are running in one transaction.
>
> Since the maximum column size is set with the OCIBindByPos and the piece
> size is set with the OCIStmtSetPieceInfo I have no clue why it does not
> works.
>
> Maybe someone can help me?
>
> Thanks
>
> >tilo
>
> P.S.: I am sorry for linguistical mistakes ... I prefer german ;)).

I can't help you with why it doesn't work, hopefully someone else can.

But I can tell you that Oracle is dropping LONG and LONG RAW so you should think about restructuring to a CLOB or BLOB.

Daniel Morgan Received on Sun Jun 09 2002 - 00:51:13 CDT

Original text of this message

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