查询1
select *
  from a
 where to_date('2012-3-31 13:00:01',
               'yyyy-mm-dd hh24:mi:ss') between start_date and end_date如果用这句查询就不能查询出数据
查询2
select *
  from a
 where to_date('2012-3-31',
               'yyyy-mm-dd hh24:mi:ss') between start_date and end_date
如果去掉时分秒,就能查询出数据。
这是为什么呢?
start_date 和end_date字段都是DATE类型我自己做了个测试declare
  v_date date;
begin
  select to_date('2011-3-31 13:00:01', 'yyyy-mm-dd hh24:mi:ss')
    into v_date
    from dual;
  if v_date > to_date('2011-3-31', 'yyyy-mm-dd') then
    dbms_output.put_line('1');
  else
    dbms_output.put_line('2');
  end if;
exception
  when others then
    dbms_output.put_line('3');
end;最后返回了 1 ,说明带时分秒的是可以和不带时分秒的比较的啊。。
我有点迷茫了。。
那位大神告诉我下原因。。