解决方案 »

  1.   


    select * from AAA where trunc(a) = trunc(sysdate);
    select * from AAA where trunc(a) = trunc(sysdate)-1;
      

  2.   


    select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1; 
    select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate); 
      

  3.   

    select * from AAA where a between sysdate-1 and  sysdate 
      

  4.   


    select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate,'yyyymmdd');
    select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate-1,'yyyymmdd');不用客气!
      

  5.   

    select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate,'YYYYMMDD');
    select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
      

  6.   

    select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate,'YYYYMMDD');
    select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
      

  7.   

    3L和1L的写法区别在于什么,为什么第二种要更好呢
    第一种trunc(a)不能使用索引,第二种可以使用索引