Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- oracle function returning sys_refcursor
November 21, 2005, 2:03 pm
rate this thread
how well yet, but it works) so i thought i'd post the solution because
i couldn't find it anywhere.
The problem I was having was we have lots of functions that return
sys_refcursor's that we use as recordsets through ADO with a windows
application, but then we needed to call these same functions from PHP,
so the solution was to use cursors, like so...
$cnn = OCILogon( 'User', Password', 'TNS' );
$cur = OCINewCursor( $cnn );
$stmt = OCIParse( $cnn, " begin :MyRefCur := MyFunction( 1, 2, 3 );
end; " );
OCIBindByName( $stmt, ":MyRefCur", $cur, -1, OCI_B_CURSOR );
OCIExecute( $stmt );
OCIExecute( $cur );
while ( OCIFetchInto($cur,$row,OCI_ASSOC) )
foreach ( $row as $name => $value )
echo "$name = '$value'<br />";
OCIFreeStatement( $stmt );
OCIFreeCursor( $cur );
OCILogoff( $cnn );
Maybe someone else has a better solution?
- » Library to manipulate background color of a picture
- — Previous thread in » PHP Scripting Forum