Detecting error in OCIExecute calls
| From: | Robert Mena | Date: | Tue, 08 May 2001 22:01:58 +0000 |
| Subject: | Detecting error in OCIExecute calls | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51992@lists.php.net to get a copy of this message | ||
Hi, I am accessing an oracle database from PHP using
stored procedures available.
I'd like to detect when a problem occurs in order to
stop trying to fetch results. In mysql I check for
rc=0 as an error. The php doc does not tell if this
applies to oracle as well.
The code is something like this
$res = OCINewCursor($oraCon);
$stm = OCIParse ( $oraCon, "
BEGIN
MY_PROCEDURE(:LOGIN, :PASS, :KEY, :INITIAL, :FINAL,
:RES);
END;
");
OCIBindByName ( $stm, ":LOGIN", &$login, -1);
OCIBindByName ( $stm, ":PASS", &$pass, -1);
OCIBindByName ( $stm, ":KEY", &$key, -1);
OCIBindByName ( $stm, ":INITIAL", &$initial, -1);
OCIBindByName ( $stm, ":FINAL", &$final, -1);
OCIBindByName ( $stm, ":RES", &$res, -1, OCI_B_CURSOR
);
$rc = @OCIExecute ( $stm );
if($rc)
{
OCIExecute ($res);
...
}
else
{
// Error do something!
}
Thanks.
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/