Re: Detecting error in OCIExecute calls
| From: | Thies C. Arntzen | Date: | Wed, 09 May 2001 08:27:35 +0000 |
| Subject: | Re: Detecting error in OCIExecute calls | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52051@lists.php.net to get a copy of this message | ||
On Tue, May 08, 2001 at 03:01:58PM -0700, Robert Mena wrote:
> 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!
$err = OCIError($stm);
var_dump($err);
> }
>
> Thanks.
re,
tc