[PHP] Oracle query with one returned record From: J. Anderson Scarbrough (jebscarbrough <email protected>)
Date: 10/15/01

When I have an oracle procedure that returns one and only one row i still
find myself looping through the cursor to get the results. is there a
better way to accomplish this without writing a loop when you know the loop
will only execute once? (code below)

Thanks.

query = "begin pkg.procedure($id, :curs, :errorCode); end;";
//query should return only the details of the $id passed in to proc.
$curs = OCINewCursor($connection);
$stmt = OCIParse ($connection, $query);
OCIBindByName ( $stmt, ":curs", &$curs,-1,OCI_B_CURSOR);
OCIBindByName ($stmt, ":errorCode", &$errorCode,10);
$result = OCIExecute ($stmt);
$result = OCIExecute ($curs);
while (OCIFetchInto($curs,$data)) {
$companyname = $data[0];
$companyaddress = $data[1];
$companyaddress2 = $data[2];
$companycity = $data[3];
$companystate = ucwords($data[4]);
$companypostalcode = $data[5];
$companycountry = ucwords($data[6]);
}
OCIFreeStatement($stmt);
OCIFreeCursor($curs);
?>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>