Re: Capturing Errors

From: Mladen Gogala <>
Date: Thu, 26 Jan 2012 17:22:02 +0000 (UTC)
Message-ID: <jfs23p$lqn$>

On Thu, 26 Jan 2012 06:35:30 -0800, ExecMan wrote:

> I thought I'd ask this in the Oracle group. Does Oracle have a way of
> returning exceptions thrown to STDERR for a PHP script to capture and
> work with?
> Short of returning the error in a cursor or as a function value, is
> there any way to capture the error that Oracle may throw? Our app team
> is asking this.

It depends on the framework you're using to work with Oracle. If you're using the native OCI8 framework, which is procedural in nature, you have to throw exceptions yourself, for every error that occurs. If, on the other hand, you are using ADOdb, it has facilities to throw exceptions which can be caught like this: try {

    $db->Connect($DSN['database'], $DSN['username'], $DSN['password']);     if (!empty($AFILE)) {

        $rs = $db->Execute($AFILE);
    $rs = $db->Execute($FILE, array('TBLSPC' => $TBLSPC));     csr2html($rs, ' ');
catch(Exception $e) {


That will catch any possible error during the connection phase, as well as the errors in SQL execution. ADOdb can be downloaded from here:

Received on Thu Jan 26 2012 - 11:22:02 CST

Original text of this message