Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: OCI - How do I retrieve result columns from a 'SELECT * FROM MYTABLE' statement
Markus, I took a look at your example because I was having some trouble
getting this same type of thing working. I had some question on why you
allocated so much memory in the following 2 sections of code.
Section 1: This adds more and more memory for each column.
nRecLen += colinfo[ii].buf_len + ( strlen( colinfo[ii].col_name ) ) + (6+2);
// allocate that memory for the work buffer colinfo[ii].pWork = (char*) malloc( nRecLen + 1 ); if ( colinfo[ii].pWork == NULL ) { printf( "panic, no memory left\n" ); exit(1); }
Section 2: If you were to add up the top, wouldn't nRecLen have the RecLen for all the columns already?
nRecLen = ( nCols * nRecLen ) + 1;
//
// alloc memory for the out buffer
//
pRec = (char*) malloc( nRecLen );
if ( pRec == NULL )
{
printf( "panic, no memory left\n" ); exit(1);
Maybe I am missing something...
Markus <nobody_at_nowhere.edu> wrote in message news:3886C685.B6717BD2_at_nowhere.edu...
> first you have to find out how many columns the result set has: > attached file line 521: OCIAttrGet( ..., ..., ..., ..., > OCI_ATTR_PARAM_COUNT, ... ); > > second you ask for each coltype: > attached file line 562+: OCIParamGet(... > > have fun > markus > > > Sebastian Corbay wrote: > > > > I use OCI to get rows from a table on Oracle 8. > > I successfully, connect to the server, prepare the statement, execute > > this statement, but... > > > > I don't know how to get the results. > > > > The problem is that I cannot set local variables (with OCIDefineByPos) > > to retrieve value through an OCIFetch, because I do not > > know how many columns are returned and the type of these columns. > > I read the Oracle Call Interface Programmer's Guide, but I did not find > > anyway how to get information about the results returned. > > > > What am I supposed to do? > > > > Thank in advance for your help!Received on Sun Jan 23 2000 - 04:42:38 CST
![]() |
![]() |