oci8 refcursors are working!
| From: | Thies C. Arntzen | Date: | Thu, 06 May 1999 11:25:06 +0000 |
| Subject: | oci8 refcursors are working! | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-5383@lists.php.net to get a copy of this message | ||
(reed below)...
ok, it's commited!!!
grab the CVS sources compile and than:
<?php
$conn = OCILogon("digicol","digicol");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"begin info.output(:data); end;");
ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs); // start working with our ref-cursor
while (OCIFetchInto($curs,&$data)) { // this loop will fetch all the data from the refcursor!!
var_dump($data);
}
OCIFreeCursor($stmt);
OCIFreeStatement($curs);
OCILogoff($conn);
?>
what doesnt work right now is selecting refcursors (only bound plsql vars will work)....
select user_name, CURSOR(select user_name from users) from users;
still won't work - but i'm working on it!!!
tc
On Thu, 6 May 1999, Piergiorgio Alotto wrote:
> Dear Thies,
>
> this is an example stored procedure which uses a REF CURSOR which will
> work on any database:
>
> CREATE OR REPLACE PACKAGE info AS
> TYPE the_data IS REF CURSOR RETURN all_users%ROWTYPE;
> PROCEDURE output(return_data IN OUT the_data);
> END info;
> /
> CREATE OR REPLACE PACKAGE BODY info AS
> PROCEDURE output(return_data IN OUT the_data) IS
> BEGIN
> OPEN return_data FOR SELECT * FROM all_users;
> END output;
> END info;
> /
>
> and this is how I access it in SQL*Plus:
>
> VARIABLE data REFCURSOR;
>
> exec info.output(:data);
> print data
>
>
> I am not quite sure how to do that in PHP. the print command does a
> series of fetch for all returned rows and then closes the cursor....
>
> Let me know what you think...
>
> Pier
>
>
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net