日期:2014-05-17 浏览次数:21734 次
create table t1 (a timestamp); insert into t1 values (TO_TIMESTAMP('2012-04-01 12:12:09', 'YYYY-MM-DD HH24:MI:SS')); insert into t1 values (TO_TIMESTAMP('2012-03-01 12:12:09', 'YYYY-MM-DD HH24:MI:SS')); insert into t1 values (TO_TIMESTAMP('2012-02-01 12:12:09', 'YYYY-MM-DD HH24:MI:SS')); insert into t1 values (TO_TIMESTAMP('2012-01-01 12:12:09', 'YYYY-MM-DD HH24:MI:SS')); insert into t1 values (TO_TIMESTAMP('2012-04-12 12:12:09', 'YYYY-MM-DD HH24:MI:SS')); select * from t1 where a >= add_months(sysdate,-3) and a <= sysdate a ----------------------------------------------- 1 01-4月 -12 12.12.09.000000 下午 2 01-3月 -12 12.12.09.000000 下午 3 01-2月 -12 12.12.09.000000 下午 4 12-4月 -12 12.12.09.000000 下午