Automatically generated statements that are partitioned by day when Oracle builds tables

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.