Oracle ORA-01861:文字与格式字符串不匹配的错误

数据库中的字段为DATATIME类型,查询时需对查询字段格式化,使用Oracle的to_date函数

SQL改为:

select t.*, t.rowid from LOGISTICS_ORDER t where t.order_date > to_date('2017-1-1', 'yyyy-mm-dd');

如果数据库中存的时间格式不一样,则在查询时需先对条件格式化,使用to_char,to_date函数

to_date(to_char(time, 'yyyy-MM-dd'), 'yyyy-mm-dd');

猜你喜欢

转载自blog.csdn.net/m0_37787662/article/details/87206452