using a REF CURSOR from a stored procedure

wxdqz

New Member
I have followed the example given in the PHP manual for OCINewCursor (see below). I get the following error message:

Warning: OCIStmtExecute: ORA-24370: Message 24370 not found; product=RDBMS; facility=ORA:

Error code definition:
ORA-24370 illegal piecewise operation attempted

Cause: Data of a certain datatype that does not support piecewise operation is being sent or fetched in pieces.

Action: Always set the piece value to OCI_ONE_PIECE for datatypes that does not support piecewise operation.

Any ideas on how to set the OCI_ONE_PIECE parameter? I tried
ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR+OCI_ONE_PIECE);
but it did not work.

Thanks.

<?php
// suppose your stored procedure info.output returns a ref cursor in :data

$conn = OCILogon("scott","tiger");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"begin info.output(:data); end;");

ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);

while (OCIFetchInto($curs,&$data)) {
var_dump($data);
}

OCIFreeCursor($curs);
OCIFreeStatement($stmt);
OCILogoff($conn);
?>
 
Back
Top