select * from tablename where col_date>to_date('02:00:07','hh24:mi:ss') and col_date<to_date('07:30:35','hh24:mi:ss');

解决方案 »

  1.   

    SQL> select to_char(doctime,'yyyy-mm-dd hh24:mi:ss'),sum(id) from test1 where do
    ctime>=to_date('2002-7-1 02.00.00','yyyy-mm-dd hh24:mi:ss') and doctime<=to_date
    ('2002-7-1 07:30:35','yyyy-mm-dd hh24:mi:ss') group by to_char(doctime,'yyyy-mm-
    dd hh24:mi:ss');
      

  2.   

    where to_char(colname, 'hh24:mi:ss') >= '02:00:00' and
          to_char(colname, 'hh24:mi:ss') <= '07:30:35' ;
      

  3.   

    SQL> select to_char(doctime,'yyyy-mm-dd hh24:mi:ss'),sum(id) from test1 where to
    _number(to_char(doctime,'hh24miss'))>=000000 and to_number(to_char(doctime,'hh24
    miss'))<=213035 group by to_char(doctime,'yyyy-mm-dd hh24:mi:ss');TO_CHAR(DOCTIME,'YYYY-MM-DDHH24:MI:SS'    SUM(ID)
    -------------------------------------- ----------
    2002-01-01 10:11:00                             6
    2002-05-01 10:12:00                             1
    2002-07-01 00:00:00                           431
    2002-08-02 00:00:00                            94
    2002-08-20 15:22:27                             1
    2002-08-22 00:00:00                            93
    2002-09-01 20:10:00                             1
    2002-09-01 20:20:00                             28 rows selected.Elapsed: 00:00:00.70