| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: LONG RAW data size
"Massis Isagholian" <massis_at_isagholian.com> wrote in
news:xWU6a.761$Uy4.64672_at_bgtnsc05-news.ops.worldnet.att.net:
> Unfortunately, both single and piecewise fetch operations (with
> OCI8) require priori knowledge of data size (number of bytes) in
> LONG RAW columns. Pre-allocating the 2GB max memory is obviously out
> of the question.
I don't think you need to know the size beforehand. Here's a snippet of code that I wrote with some comments:
/* Ensure that OCI_NEED_DATA is returned */ status = OCIStmtFetch(*l_dbproc.statement_hp,
*l_dbproc.error_hp,
(sword ) 1,
OCI_FETCH_NEXT,
OCI_DEFAULT);
/* In typical situations, this would be in a while-loop but
if (status == OCI_NEED_DATA) {
status = OCIStmtGetPieceInfo(*l_dbproc.statement_hp,
*l_dbproc.error_hp,
(dvoid **) &define_hp,
(ub4 *) &type_hp,
(ub1 *) &in_out,
(ub4 *) &iter,
(ub4 *) &idx,
(ub1 *) &piece);
if (status)
{
assign_cda_retcode(status);
return(status);
}
status = OCIStmtSetPieceInfo((dvoid *) define_hp,
type_hp,
*l_dbproc.error_hp,
(dvoid *) buf,
(ub4 *) &len,
piece,
(dvoid *) &ind,
(ub2 *) &return_code);
if (status)
{
assign_cda_retcode(status);
return(status);
}
status = OCIStmtFetch(*l_dbproc.statement_hp,
*l_dbproc.error_hp,
(sword ) 1,
OCI_FETCH_NEXT,
OCI_DEFAULT);
if (status != OCI_SUCCESS)
{
if (status)
{
assign_cda_retcode(status);
return(status);
}
}
if(status)
{
assign_cda_retcode(status);
return(status);
}
-- Pablo Sanchez, High-Performance Database Engineering http://www.hpdbe.comReceived on Tue Feb 25 2003 - 20:33:58 CST
![]() |
![]() |