Oracle dynamically establishes partitioned tables

Source: Internet
Author: User

Because there is too much data to speed up retrieval

To build a table as a partitioned table

Adding temporary tables dynamically when data is inserted

 as  --Local variables hereFq_dmvarchar( -); P_count Number; --p_fadm number;P_sqlvarchar( -);begin  --Test Statements here  --querying all partitions of Zkz--SELECT partition_name from user_tab_partitions WHERE table_name= ' ZHZ_MN_FQ ';FQ_DM:='ZHZ_MN_FQ'||P_FA_DM;--Partition name     Select Count(*) intoP_count fromUser_tab_partitionsWHEREtable_name='ZKZ_MN_FQ'  andPartition_name=FQ_DM; ifP_count=0  Then --if the partition does not exist, this creates the partitionP_sql:='ALTER TABLE ZKZ_MN_FQ add partition'||Fq_dm||'VALUES ('||P_fa_dm||') tablespace USERS'; Executeimmediate p_sql; End if; Insert  intoMn_fqValues(p_zh,p_k_id, P_z, P_BM, P_xq, P_DQ, P_FA_DM); Commit; 

 

Related Article

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.