日报,每天23:59:59秒执行一次,统计当日信息!
Selece * from table 
where date>=to_date('2010-08-11 00:00:00','yyyy-mm-dd hh24:mi:ss')
and date<=to_date('2010-08-11 23:59:59','yyyy-mm-dd hh24:mi:ss')
每天的日期都不一样,怎么得到?
并且拼接成'2010-08-11 00:00:00''2010-08-11 23:59:59

解决方案 »

  1.   

    between trunc(sysdate) and trunc(sysdate+1)-1/24/60/60
      

  2.   

    Selece * from table 
    where date>=to_date(to_char(sysdate,'yyyy-mm-dd')+' 00:00:00','yyyy-mm-dd hh24:mi:ss')
    and date<=to_date(to_char(sysdate,'yyyy-mm-dd')+' 23:59:59','yyyy-mm-dd hh24:mi:ss')
      

  3.   

    SQL> select trunc(sysdate) from dual;
     
    TRUNC(SYSDATE)
    --------------
    2010-8-11
     
    SQL> select trunc(sysdate+1)-1/24/60/60 from dual;
     
    TRUNC(SYSDATE+1)-1/24/60/60
    ---------------------------
    2010-8-11 23:59:59
     
    SQL> 
      

  4.   

    select to_date(to_char(sysdate, 'yyyy-mm-dd') || ' 00:00:00',
                   'yyyy-mm-dd hh24:mi:ss'),
           to_date(to_char(sysdate, 'yyyy-mm-dd') || ' 23:59:59',
                   'yyyy-mm-dd hh24:mi:ss')
      from dual;
      

  5.   

    select trunc(sysdate)+1/(24*60*60) early_time,trunc(sysdate+1)-1/(24*60*60) late_time from dual;