Re: oracle8

From: Date: Sat, 02 Dec 2000 12:12:07 +0000
Subject: Re: oracle8
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4953@lists.php.net to get a copy of this message
Dave Fudge wrote: > > ammendment, > is there a way to get both OCIFetchSTatement and OCIFetchInto > without using OCIExecute() twice? > No, but after doing OCIFetchStatement() you have the complete resultset stuffed into an array where you can access it. The return value of OCIFetchStatement() indicates the number of rows found, this might be helpful for your second question. But be aware that OCIFetchStatement() can take huge amounts of memory, depending on your resultset data, so there are cases where it would be better not to use it but get the results row by row. > part 2: > is there an easier way than using $i=0 > > while (OCIFetchInto($sth,&$row,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS)) > { > $i = $i+1; > } > > to find the number of rows affected by a select? > > apparently OCIRowCount won't work. If you absolutely need the number of rows in a select, consider doing first a "select count() as numrows ..." to get the desired information without fetching a possibly huge resultset. I've found that in 99,9% it is perfectly possible to live without knowing the number of rows in a result set. If you want to limit the number of rows returned, use the pseudocolumn ROWNUM (see Oracle SQL docs). HTH, Andreas

« previous php.db (#4953) next »