|
Posted by naph on 10/30/11 11:32
Hi, I've had this problem, and managed to solve it now (i don't know
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?
Navigation:
[Reply to this message]
|