Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How can I read/write a CLOB using Pro*C ?
In article <3940f633_at_news.lhsgroup.com>,
"Peter Dickmann" <pdickmann_at_de.lhsgroup.com> wrote:
> Hi,
>
> I managed to read/write a CLOB by specifying:
>
> OCIClobLocator *locator;
> varchar *data;
> data = (varchar *) malloc( 2 + size );
> data->len = (short)size;
> strcpy( data->arr, my_data );
> EXEC SQL LOB WRITE ONE :size FROM :data INTO :locator;
>
> But, the varchar isn't sufficient to hold my_data, hence I tried to
use LONG
> VARCHAR, here the len field is an integer rather than a short. But the
> declaration:
>
> long varchar *data;
>
> is illegal; what's missing?
>
> Thanx, Peter
>
>
see sample4.pc
it'll be along the lines of:
/* This is the definition of the long varraw structure. * Note that the first field, len, is a long instead * of a short. This is becuase the first 4 * bytes contain the length, not the first 2 bytes. */
/* Type Equivalence long_varraw to LONG VARRAW. * All variables of type long_varraw from this point * on in the file will have external type 95 (LONG VARRAW) * associated with them. */
and then you'll use the type long_varraw. (or long_varchar -- changing the LONG VARRAW into LONG VARCHAR)
-- Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries Howtos and such: http://osi.oracle.com/~tkyte/index.html Oracle Magazine: http://www.oracle.com/oramag Opinions are mine and do not necessarily reflect those of Oracle Corp Sent via Deja.com http://www.deja.com/ Before you buy.Received on Fri Jun 09 2000 - 00:00:00 CDT
![]() |
![]() |