Oracle中date类型数据的使用

原创
2017/03/01 10:39
阅读数 174

delete from mss_emp_attendance where emp_id = #{employeeId} and check_date between to_date(#{month},'yyyy-MM-dd') and add_months(to_date(#{month},'yyyy-MM-dd'),1)+1

对比:

delete from mss_emp_attendance where emp_id = #{employee} and to_char(check_date,'yyyy-MM') = #{month}

如果因为数据量大对check_date创建了索引,这时候如果对check_date使用to_char(),to_date()函数将大大降低数据操作的效率,失去了创建索引的作用。
     

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部