PDO bindParam and TO_DATE conversion
624894Aug 15 2008 — edited Aug 22 2008I am using Oracle XE, and I am trying to insert data into a table having a blob column, I am however having problems with the date column.
The date to be inserted has to be converted to a format oracle understands, how do I do this with bindParam. Here is what I am doing (in PHP) :
$entryDate = 'August 05, 2008';
$imageInfo = getimagesize($passportFile);
$date_created = null;
$type = null;
$passportBinary = null;
$stmt = $PDO->prepare("INSERT INTO blobtest (date_created, type, binary) VALUES(:date_created, :type, EMPTY_BLOB()) RETURNING binary INTO :binary");
$stmt->bindParam(':type', $type);
$stmt->bindParam(':date_created', $date_created);
$stmt->bindParam(':binary', $passportBinary, PDO::PARAM_LOB);
$date_created = "TO DATE('$entryDate', 'MONTH DD, YYY')";
$type = $imageInfo['mime'];
$passportBinary = fopen($passportFile, 'rb');
$stmt->execute();
Is there a better way around it ??