数据仓库服务 GaussDB(DWS)-表(Oracle):分区(一)

时间:2025-01-26 10:51:39

分区(一)

在非分区表中,为表“ALTER TABLE TRUNCATE PARTITION”添加注释。

Oracle语法

迁移后语法

 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031323334353637383940414243
CREATE TABLE product_range(  product_id      VARCHAR2(20),  Product_Name    VARCHAR2(50),  Year_Manufacture DATE)partition by range (Year_Manufacture)(  partition Year_Manufacture values less than (TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'))    pctfree 10    initrans 1);CREATE TABLE product_list(  product_id      VARCHAR2(20),  Product_Name    VARCHAR2(50),  Year_Manufacture vARCHAR2(10))partition by list (Year_Manufacture)(  partition P_2020 VALUES (2020)    pctfree 10    initrans 1);CREATE OR REPLACE PROCEDURE Range_testISV_ID VARCHAR2(10);BEGINEXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID;NULL;END;/CREATE OR REPLACE PROCEDURE List_testISV_ID VARCHAR2(10);BEGINEXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID;NULL;END;/

 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031323334353637383940414243
CREATE TABLE product_range(  product_id      VARCHAR2(20),  Product_Name    VARCHAR2(50),  Year_Manufacture DATE)partition by range (Year_Manufacture)(  partition Year_Manufacture values less than (TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'))    pctfree 10    initrans 1);CREATE TABLE product_list(  product_id      VARCHAR2(20),  Product_Name    VARCHAR2(50),  Year_Manufacture vARCHAR2(10))/*partition by list (Year_Manufacture)(  partition P_2020 VALUES (2020)    pctfree 10    initrans 1)*/;CREATE OR REPLACE PROCEDURE Range_testISV_ID VARCHAR2(10);BEGINEXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID;NULL;END;/CREATE OR REPLACE PROCEDURE List_testISV_ID VARCHAR2(10);BEGIN/*EXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID;*/NULL;END;/

support.huaweicloud.com/tg-dws/dws_mt_0108.html