例如查询表A中的state_date字段的时间在2003年8月1日12点38分33秒到2003年8月10日15点15分15秒之间的记录,语句如下:
select * from A where state_date between to_date('03-08-01 12:38:33','yy-mm-dd hh24:mi:ss') and to_date('030810 15:15:15','yymmdd hh24:mi:ss');
此语句等价于:
select * from A where state_date>=to_date('03-08-01 12:38:33','yy-mm-dd hh24:mi:ss') and state_date<=to_date('030810 15:15:15','yymmdd hh24:mi:ss');