top-think / think-orm

Think ORM——the PHP Database&ORM Framework
Apache License 2.0
416 stars 173 forks source link

thinkphp6插入oracle数据库date类型字段报错 #307

Open rehack opened 3 years ago

rehack commented 3 years ago
$data = [
'name'=>$param['name'],
'phone'=>$param['phone'],
'time'=>date('Y/m/d H:i:s' ,time())
];
Db::table('CUSTOMER')->strict(false)->insert($data);

执行插入的时候就会报错: SQLSTATE[HY000]: General error: 1861 OCIStmtExecute: ORA-01861: 文字与格式字符串不匹配

尝试使用http://www.thinkphp.cn/topic/27014.html 这个方法 也不行 请教下该怎么处理time数据啊?

a641336552 commented 3 months ago

$data['time'] = Db::raw("TO_DATE('$time', 'YYYY-MM-DD HH24:MI:SS')");