oracle sql日期比较方法汇总

数据库 码拜 11年前 (2013-09-17) 1687次浏览 0个评论
oracle sql日期比较:
在今天之前:
select * from up_date where update < to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
select * from up_date where update <= to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
在今天只后:
select * from up_date where update > to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
select * from up_date where update >= to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
精确时间:
select * from up_date where update = to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
在某段时间内:
select * from up_date where update between to_date(‘2007-07-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’) and to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
select * from up_date where update < to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’) and update > to_date(‘2007-07-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)
select * from up_date where update <= to_date(‘2007-09-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’) and update >= to_date(‘2007-07-07 00:00:00′,’yyyy-mm-dd hh24:mi:ss’)

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明oracle sql日期比较方法汇总
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!