Reputation: 21
How does one save the date in Yii with Oracle?
$trx->DATE_TRX=date('Y-m-d');
CDbCommand failed to execute the SQL statement:
SQLSTATE[HY000]: General error: 1861
OCIStmtExecute: ORA-01861: literal does not match format string
(ext\pdo_oci\oci_statement.c:148).
The SQL statement executed was:
INSERT INTO "TRX" ("IDMEMBER", "DATE_TRX") VALUES (:yp0, :yp1) RETURNING "ID" INTO :RETURN_ID
Upvotes: 0
Views: 1129
Reputation: 52346
I would guess that you're supplying a character literal as the date, in a format such as 'yyyy-mm-dd'. If so then you should explicitly convert that to a date as part of the insert statement ...
INSERT INTO "TRX" ("IDMEMBER", "DATE_TRX")
VALUES (:yp0, to_date(:yp1,'yyyy-mm-dd'))
RETURNING "ID" INTO :RETURN_ID
Upvotes: 1