I have an Oracle database that I am connecting to with PHP OCI8. One of my methods takes a Base64 Encoded image and decodes it and attempts to insert the image as a Blob. Oracle throws an the exception identifier is too long.
$query = "
insert into field_call_photos (photo_datetime, field_call_visit_pk, photo, field_call_photo_type_pk)
values (to_date('$visitDT $visitDTHrs $visitDTMins $visitDTAmpm','mm/dd/yyyy hh:mi am'),
'$newFcvPK', utl_encode.base64_decode(utl_raw.cast_to_raw($fileBlob)),'$fileTypePK')";
You code seems to insert file content into the SQL query without quoting, which probably makes Oracle think it’s an identifier.
I would use OCI blob functions instead. Something like this:
I am omitting error checking for simplicity, you would need to check if the parse and the execute returned proper things and use oci_error to see what went wrong.