table t
字段cdate的类型是DATE ,存储的数据格式是 yyyy-mm-dd
我这样查询没问题
select * from t where t.cdate = to_date('日期','yyyy-mm-dd') 日期传递数据的格式是yyyy-mm-dd现在存储的数据格式变了 yyyy-mm-dd hh:mm:ss,就查不出来了.
请问下怎么改最方便,因为sql语句改动的地方会比较多
字段cdate的类型是DATE ,存储的数据格式是 yyyy-mm-dd
我这样查询没问题
select * from t where t.cdate = to_date('日期','yyyy-mm-dd') 日期传递数据的格式是yyyy-mm-dd现在存储的数据格式变了 yyyy-mm-dd hh:mm:ss,就查不出来了.
请问下怎么改最方便,因为sql语句改动的地方会比较多
select * from t where t.cdate = trunc(to_date('日期','yyyy-mm-dd hh:mm:ss'));
如果我这么写呢
select * from t where to_char(t.cdate,'YYYY-MM-DD') ='日期'
执行效率上会有什么不同或会造成哪些未知的问题?
select * from t where to_char(t.cdate,'YYYY-MM-DD') ='日期'
这2个都行