Inserting into Oracle BLOB column triggers "ORA-01465: invalid hex number"

I was trying to insert a value into a BLOB column. I was using Zend PHP oracle adapter (oci8_* functions) and binding my BLOB value by name.

I got the Oracle error "ORA-01465: invalid hex number" but didn't know how to fix it. I thought maybe I had to use the Oracle LOB objects included with PHP.

Related tags: Oracle PHP

With my 10g driver, using PHP's LOB objects was not needed. I simply needed to run bin2hex() on my BLOB value before binding it and inserting it.

On insert and update, bin2hex() is needed, but on select, the data comes out as binary so running hex2bin() is not necessary.

Rating: 2

Propose a different solution...