Oracle query with one returned record

From: Date: Mon, 15 Oct 2001 13:57:18 +0000
Subject: Oracle query with one returned record
Groups: php.general 
Request: Send a blank email to php-general+get-71101@lists.php.net to get a copy of this message
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

« previous php.general (#71101) next »