Re: note 93924 added to function.oci-set-prefetch
| From: | Christopher Jones | Date: | Wed, 07 Oct 2009 01:04:02 +0000 |
| Subject: | Re: note 93924 added to function.oci-set-prefetch | ||
| References: | 1 2 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161426@lists.php.net to get a copy of this message | ||
Dan,
Thanks for the pickup. I've readded the comment and will delete
the old one.
Chris
Daniel Brown wrote:
-- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrdChris;In the note you just added (below), the code is incomplete. Wantto update it or re-add it? On Tue, Oct 6, 2009 at 20:57, <sixd@php.net> wrote:With Oracle 11gR2, prefetching also works when fetching from REF CURSORS and nested queries. To use a non default prefetch count, use oci_set_prefetch. For example, on the REF CURSOR statement handle: $stid = oci_parse($c, "call myproc(:rc)"); $refcur = oci_new_cursor($c); oci_bind_by_name($stid, ':rc', $refcur, -1, OCI_B_CURSOR); oci_execute($stid); oci_set_prefetch($refcur, 200); oci_execute($refcur); oci_fetch_all($refcur, $res); var_dump($res); REF CURSOR prefetching can be used when PHP is linked with Oracle 11gR2 libraries and connected to previous database versions of the database. Nested cursor prefetching requires both the Oracle client libraries linked with PHP and the database to be Oracle Database 11gR2 From PHP 5.3.2 (PHP OCI8 >= 1.4) the prefetch value may be set to 0. Previously the lower bound was 1. If PHP OCI8 fetches from a REF CURSOR and then passes the REF CURSOR back to a second PL/SQL procedure for further processing, set the REF CURSOR prefetch count to 0 to avoid rows being "lost" from the result set. // get the REF CURSOR $stid = oci_parse($c, "call myproc_get_rc(:rc_out)"); $refcur = oci_new_cursor($c); oci_bind_by_name($stid, ':rc_out', $refcur, -1, OCI_B_CURSOR); oci_execute($stid); // Fetch one row and display it oci_set_prefetch($refcur, 0); // don't prefetch rows that aren't displayed oci_execute($refcur); $row = oci_fetch_array($refcur); var_dump($res); // pass the REF CURSOR to myproc_use_rc() to do more data processing $stid = oci_parse($c, "call myproc_use_rc(:rc_in)"); oci_bind_by_name($s ---- Server IP: 69.147.83.197 Probable Submitter: 148.87.1.172 ---- Manual Page -- http://www.php.net/manual/en/function.oci-set-prefetch.phpEdit -- https://master.php.net/note/edit/93924Del: integrated -- https://master.php.net/note/delete/93924/integratedDel: useless -- https://master.php.net/note/delete/93924/useless Del: bad code -- https://master.php.net/note/delete/93924/bad+code Del: spam -- https://master.php.net/note/delete/93924/spamDel: non-english -- https://master.php.net/note/delete/93924/non-englishDel: in docs -- https://master.php.net/note/delete/93924/in+docsDel: other reasons-- https://master.php.net/note/delete/93924Reject -- https://master.php.net/note/reject/93924 Search -- https://master.php.net/manage/user-notes.php-- PHP Notes Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php