PDA

View Full Version : php-oracle error handling



laukis
July 2nd, 2004, 04:50 AM
Hello
Im trying to print the oracle error messages.

Its working fine with connection failure:


putenv("ORACLE_SID=...");

$ora_conn = @ora_logon (".. ",".."); //Establishes a connection to Oracle

if (!$ora_conn) { //if the connection could not be established
echo ora_error(); //print the Oracle error message (logon failure) Working
exit;
} //end if

But when I type an invalid query I only get
ORA-00000: normal, vellykket fullføring (normal, successful......)
when I should get something like "SP2-0042: invalid.......... "



$ora_cur = @ora_do( $ora_conn, $query ); // Parse, exec and fetch the query (parse and execute a statement, then fetch the first result row)

if (!$ora_cur) { //if failure
echo ora_error();
exit;
}//end if