Oracle date processing -- calculate the year month day select to_char (sysdate, 'yyyymmdd'), sysdate from dual; -- calculate the year month day system yesterday select to_char (sysdate-1, 'yyyymmdd'), sysdate from dual; -- calculate the day before yesterday of the year, month, and day system select to_char (sysdate-2, 'yyyymmdd'), sysdate from dual; -- calculate the year, month, and day system tomorrow select to_char (sysdate + 1, 'yyyymmdd '), sysdate from dual; -- calculate the acquired select to_char (sysdate + 2, 'yyyymmdd'), sysdate from dual; -- calculate weekly select to_char (sysdate, 'yyyww '), sysdate from dual; -- 201248 -- year and month (number) select to_number (to_char (sysdate, 'yyymmm ') from dual; -- 201211 -- year and month (character) select to_char (sysdate, 'yyyymm') from dual; -- 201211 -- month (number) select to_number (to_char (sysdate, 'mm') from dual; -- 11 -- month (character) select to_CHAR (sysdate, 'mm') from dual; -- 11 select to_CHAR (to_date ('20170101', 'yyymmm'), 'mm') from dual; -- 01 select to_CHAR (to_date (select to_number (to_char (sysdate, 'yyyymm') from dual), 'yyyymm'), 'mm') from dual; -- 11 SELECT TO_NUMBER (TO_CHAR (TO_DATE ('201312', 'yyymmm'), 'mm') from dual; cycle date declare -- Local variables here I integer; a varchar2 (100); begin -- Test statements here I: = 0; while I <31 loop select to_char (to_date ('2013', 'yyyymmdd') + I, 'yyyymmdd') into a from dual; dbms_output.put_line (I | ':' | a); I: = I + 1; end loop; end;