DECLAREV_sqlVARCHAR2( +); V_sql_headVARCHAR2( -); V_sql_tailVARCHAR2(Ten); V_dayVARCHAR2(8); CURSORC_cur is SELECTTo_char ((To_date ('2012-01','yyyy-mm')+(ROWNUM- 1)), 'YYYYMMDD') S_date fromDUAL CONNECT byROWNUM<=Last_day (To_date ('2012-12','yyyy-mm'))-To_date ('2012-01','yyyy-mm')+ 1; BEGINDbms_output. ENABLE (1000000); OPENc_cur; V_sql_head:= 'PARTITION by RANGE (acct_day)' ||CHR ( -)|| '('; V_sql_tail:=CHR ( -)|| ')'; Dbms_output. Put_Line (V_sql_head); LOOPFETCHC_cur intoV_day;EXIT whenC_cur%NOTFOUND; V_sql:= 'PARTITION Part_' ||V_day|| ' ' || 'VALUES less THAN (" " ||To_char (To_date (V_day,'YYYYMMDD')+ 1),'YYYYMMDD')|| " ")'; Dbms_output. Put_Line (V_sql); ENDLOOP; Dbms_output. Put_Line (V_sql_tail); CLOSEc_cur;END;
The result of this statement is that the 2012 year partition is generated, not heavy. Specific changes to the situation. Do not spray.
Automatically generated statements that are partitioned by day when Oracle builds tables