我这样写了
select *
from a
where a_date=(sysdate+2)
选不出结果(插入的数据没问题,有符合条件的元组)
或者
where a_date=to_date(sysdate+2,'yyyy/mm/dd')
也不对。
而where a_date<(sysdate+2)则可以选出时间小于两天后的元组
这样写
select *
from a
where a_date=to_date('2010/8/22','yyyy/mm/dd')
就可以了 这是为什么呢?
select *
from a
where a_date=(sysdate+2)
选不出结果(插入的数据没问题,有符合条件的元组)
或者
where a_date=to_date(sysdate+2,'yyyy/mm/dd')
也不对。
而where a_date<(sysdate+2)则可以选出时间小于两天后的元组
这样写
select *
from a
where a_date=to_date('2010/8/22','yyyy/mm/dd')
就可以了 这是为什么呢?
直接用
select *
from a
where a_date=trunc(sysdate)+2
就可以了, 得注意你匹配的数据是否包含时分秒、是否需要trunc(a_date),边界值需要了解清楚。
这样
直接用日期与天数相加减