views:

41

answers:

1

Not sure if that makes sense, but say I have this code...

$updateSql = oci_parse($conn, 'update "table" SET
"column"=:column where "Unique_Record_Id" = :Unique_Record_Id');
OCIBindByName($updateSql, ":Unique_Record_Id", $absenceData['Unique_Record_Id']);
OCIBindByName($updateSql, ":column", $column);

if(oci_execute($updateSql)){
 // np
} else {
 echo "I want an error code here please :(";
}

Is there anyway to display an ORA error message in the else statement please? Apologies for the random question, but since binding doesn't really generate proper SQL I can't just copy & paste it easily into SQL developer.

Thanks!

+1  A: 

Hi Nick,

you would use oci_error($updateSql) in your else block to retrieve the error code and message from Oracle.

Vincent Malgrat
So simple, but works absolutely perfectly! Returns the ORA code, description and the SQL - absolutely perfect, thanks!!
Nick