17,382
社区成员




SQL> select * from t1;
TIME
--------------------
2009-11-17 12:10:20
2009-11-16 12:10:20
2009-11-16 15:10:20
SQL> select * from t1
2 where time between '09-11-16 13:
3 00:00' and '09-11-17 13:00:00';
no rows selected
SQL> select * from t1
2 where time between '2009-11-16 13:
3 00:00' and '2009-11-17 13:00:00';
TIME
--------------------
2009-11-17 12:10:20
2009-11-16 15:10:20
SQL> create table t1(time varchar2(20));
Table created.
SQL> insert into t1 values('2009-11-17 12:10:20');
1 row created.
SQL> insert into t1 values('2009-11-16 12:10:20');
1 row created.
SQL> insert into t1 values('2009-11-16 15:10:20');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
TIME
--------------------
2009-11-17 12:10:20
2009-11-16 12:10:20
2009-11-16 15:10:20
SQL> select * from t1
2 where to_date(time,'YYYY-MM-DD HH24:MI:SS') between to_date('2009-11-16 13:
00:00','YYYY-MM-DD HH24:MI:SS') and to_date('2009-11-17 13:00:00','YYYY-MM-DD HH
24:MI:SS');
TIME
--------------------
2009-11-17 12:10:20
2009-11-16 15:10:20