I have an application which connects to my Oracle Database through PHP OCI.
I am receiving the error from the database call like bellow
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid); // For oci_execute errors pass the statement handle
die($callback . '(' . json_encode(
array_merge(
array(
'STATUS' => 'FALSE'
),
array(
'ERROR_MESSAGE' => $e['message']
)
)
) .
' )
');
My problem is, the error is always too long because it drills down to the source of the error like below
"ORA-01841: (full) year must be between -4713 and +9999, and not be 0 ORA-06512: at "APPOWN.CLIENTINTERFACE", line 133 ORA-06512: at "APPOWN.CLIENTORDER_API", line 3609 ORA-06512: at "APPOWN.CLIENTORDER_API", line 447 ORA-06512: at "APPOWN.CLIENTORDER_API", line 3184 ORA-06512: at line 26"
I only need the top level error message like below
(full) year must be between -4713 and +9999, and not be 0
Is there a way (except doing some text work on the response string) to get a simple error message?