Posted By

mifly on 11/27/08


Tagged

sql date


Versions (?)

date


 / Published in: SQL
 

  1. --明天
  2. SELECT trunc(v_begin_date_t + 1,'DDD') INTO v_begin_date FROM dual;
  3. SELECT trunc(v_end_date_t + 1,'DDD') INTO v_end_date FROM dual;
  4. --下个月
  5. SELECT trunc(add_months(v_begin_date_t, +1), 'mm') INTO v_begin_date FROM dual;
  6. SELECT trunc(LAST_DAY(add_months(v_end_date_t, +1)),'DDD') INTO v_end_date FROM dual;
  7. --下季度
  8. SELECT trunc(add_months(v_begin_date_t, +3), 'mm') INTO v_begin_date FROM dual;
  9. SELECT add_months(v_end_date_t, +3) INTO v_end_date FROM dual;
  10. --明年
  11. SELECT trunc(add_months(v_begin_date_t, +12), 'yyyy') INTO v_begin_date FROM dual;
  12. SELECT add_months(v_end_date_t, +12) INTO v_end_date FROM dual;

Report this snippet  

You need to login to post a comment.