select * from lis_info WHERE receive_time BETWEEN to_date('2008-08-21','yyyy-mm-dd') and to_date('2008-08-22','yyyy-mm-dd')
上面这条语句,是显示8月22日这天的记录,如果连的是sql的话,直接用datediff就能显示当前日,可是,如果连到orcal的话,怎么样让他得到当前日期呢。

解决方案 »

  1.   

    select sysdate from dual;
      

  2.   

    1.显示当前时间select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') current_time from dual;/*
    CURRENT_TIME       
    -------------------
    2007-09-29 09:29:03
    1 row selected
    */select current_date current_time from dual;/*
    CURRENT_TIME   
    ----------------
    2007-9-29 10:34:
    1 row selected
    */2.只显示日期,不显示时间select to_char(sysdate,'yyyy-mm-dd') current_date from dual;/*
    CURRENT_DATE
    ------------
    2007-09-29  
    1 row selected
    */
      

  3.   

    谢谢,但是我怎么应用到我的select语句中呢,我是想查询表lis_info中全部今日的记录。
      

  4.   


    select * from tb where to_char(lis_info ,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')