云服务器内容精选
-
全局临时表 全局临时表迁移为本地临时表。 输入:GLOBAL TEMPORARY TABLE CREATE GLOBAL TEMPORARY TABLE "Pack1"."GLOBAL_TEMP_TABLE" ( "ID" VARCHAR2(8) ) ON COMMIT DELETE ROWS ; 输出 CREATE LOCAL TEMPORARY TABLE "Pack1_GLOBAL_TEMP_TABLE" ( "ID" VARCHAR2 (8) ) ON COMMIT PRESERVE ROWS ; 父主题: 模式对象
-
列 xmax、xmin、left、right、maxvalue为 GaussDB (DWS)关键字,这些关键字应全字母大写并加英文双引号("")。 Oracle语法 迁移后语法 1 2 3 4 5 6 7 8 create table product ( xmax VARCHAR2(20), xmin VARCHAR2(50), left VARCHAR2(50), right VARCHAR2(50), maxvalue VARCHAR2(50) ); 1 2 3 4 5 6 7 8 CREATE TABLE product1 ( "XMAX" VARCHAR2(20), "XMIN" VARCHAR2(50), "LEFT" VARCHAR2(50), "RIGHT" VARCHAR2(50), "MAXVALUE" VARCHAR2(50) );
-
TYPE 将“MDSYS.MBRCOOR DLI ST”替换为“CLOB”。 Oracle语法 迁移后语法 1 2 3 4 5 create table product_part ( partid VARCHAR2(24), mbrcoords MDSYS.MBRCOORDLIST ); 1 2 3 4 5 CREATE TABLE product_part ( partid VARCHAR2(24), mbrcoords CLOB );
-
间隔分区 对于间隔分区,应该注释分区。 Oracle语法 迁移后语法 1 2 3 4 5 6 7 8 9 CREATE TABLE product ( product_id VARCHAR2(20), product_name VARCHAR2(50), manufacture_month DATE ) partition by range (manufacture_month) interval (NUMTODSINTERVAL (1, 'MONTH')) ( partition T_PARTITION_2018_11_LESS values less than (TO_DATE(' 2018-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS'))); 1 2 3 4 5 6 7 8 9 CREATE TABLE product ( product_id VARCHAR2(20), product_name VARCHAR2(50), manufacture_month DATE ) /*partition by range (manufacture_month) interval (NUMTODSINTERVAL (1, 'MONTH')) ( partition T_PARTITION_2018_11_LESS values less than (TO_DATE(' 2018-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')))*/;
-
分区(一) 在非分区表中,为表“ALTER TABLE TRUNCATE PARTITION”添加注释。 Oracle语法 迁移后语法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 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_test IS V_ID VARCHAR2(10); BEGIN EXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID; NULL; END; / CREATE OR REPLACE PROCEDURE List_test IS V_ID VARCHAR2(10); BEGIN EXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID; NULL; END; / 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 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_test IS V_ID VARCHAR2(10); BEGIN EXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID; NULL; END; / CREATE OR REPLACE PROCEDURE List_test IS V_ID VARCHAR2(10); BEGIN /*EXECUTE IMMEDIATE 'ALTER TABLE product TRUNCATE PARTITION PART'||V_ID;*/ NULL; END; /
-
分区(二) 在非分区表中,删除表“ALTER TABLE TRUNCATE PARTITION”中的数据。 Oracle语法 迁移后语法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 CREATE TABLE product_list ( product_id VARCHAR2(20), Product_Name VARCHAR2(50), Year_Manufacture vARCHAR2(10) ) partition by list (Year_Manufacture) ( partition PART_2015 VALUES (2011,2012,2013,2014,2015) pctfree 10 initrans 1 , partition PART_2016 VALUES (2016) pctfree 10 initrans 1 , partition PART_2017 VALUES (2017) pctfree 10 initrans 1 , partition PART_2018 VALUES (2018) pctfree 10 initrans 1 , partition PART_2019 VALUES (2019) pctfree 10 initrans 1 , partition PART_2020 VALUES (2020) pctfree 10 initrans 1 , PARTITION PART_unknown VALUES (DEFAULT) ); CREATE OR REPLACE PROCEDURE List_test IS V_ID VARCHAR2(10); BEGIN EXECUTE IMMEDIATE 'ALTER TABLE product_list TRUNCATE PARTITION PART_2020; NULL; END; / CREATE OR REPLACE PROCEDURE List_test IS V_ID VARCHAR2(10); BEGIN EXECUTE IMMEDIATE 'ALTER TABLE product_list TRUNCATE PARTITION PART_' || V_ID; NULL; END; / 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 CREATE TABLE product_list ( product_id VARCHAR2(20), Product_Name VARCHAR2(50), Year_Manufacture vARCHAR2(10) ) /*partition by list (Year_Manufacture) ( partition PART_2015 VALUES (2011,2012,2013,2014,2015) pctfree 10 initrans 1 , partition PART_2016 VALUES (2016) pctfree 10 initrans 1 , partition PART_2017 VALUES (2017) pctfree 10 initrans 1 , partition PART_2018 VALUES (2018) pctfree 10 initrans 1 , partition PART_2019 VALUES (2019) pctfree 10 initrans 1 , partition PART_2020 VALUES (2020) pctfree 10 initrans 1 , PARTITION PART_unknown VALUES (DEFAULT) )*/; CREATE OR REPLACE PROCEDURE List_test IS V_ID VARCHAR2(10); BEGIN EXECUTE IMMEDIATE 'ALTER TABLE product_list TRUNCATE PARTITION PART_' || V_ID; NULL; END; / CREATE OR REPLACE PROCEDURE List_test IS V_ID VARCHAR2(10); BEGIN /* EXECUTE IMMEDIATE 'ALTER TABLE product_list TRUNCATE PARTITION PART_' || V_ID; */ IF 'PART_' || V_ID = 'PART_2015' THEN DELETE FROM product_list WHERE Year_Manufacture IN (2011,2012,2013,2014,2015); ELSIF 'PART_' || V_ID = 'PART_2016' THEN DELETE FROM product_list WHERE Year_Manufacture IN (2016); ELSIF 'PART_' || V_ID = 'PART_2017' THEN DELETE FROM product_list WHERE Year_Manufacture IN (2017); ELSIF 'PART_' || V_ID = 'PART_2018' THEN DELETE FROM product_list WHERE Year_Manufacture IN (2018); ELSIF 'PART_' || V_ID = 'PART_2019' THEN DELETE FROM product_list WHERE Year_Manufacture IN (2019); ELSIF 'PART_' || V_ID = 'PART_2020' THEN DELETE FROM product_list WHERE Year_Manufacture IN (2020); ELSE DELETE FROM product_list WHERE Year_Manufacture NOT IN (2011,2012,2013,2014,2015,2016,2017,2018,2019,2020); END IF; NULL; END; /
-
SEGMENT CREATION GaussDB(DWS)不支持SEGMENT CREATION { IMMEDIATE | DEFERRED },因此该语句在迁移后被注释掉,需要设置commentStorageParameter=true。 输入:TABLE,使用SEGMENT CREATION 1 2 3 4 5 6 7 8 9 10 11 12 13 CREATE TABLE T1 ( MESSAGE_CODE VARCHAR2(50), MAIL_TITLE VARCHAR2(1000), MAIL_BODY VARCHAR2(1000), MAIL_ADDRESS VARCHAR2(1000), MAIL_ADDRESS_CC VARCHAR2(1000) ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOG GING STORAGE( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE Test ;
-
分区(注释约束) oracle配置参数中“#分区表唯一或主键约束”为“comment_unique”。 Oracle语法 迁移后语法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 CREATE TABLE TBL_ORACLE ( ID Number, Name VARCHAR2(100 BYTE), ADDRESS VARCHAR2(200 BYTE) ) TABLESPACE space1 PCTUSED 40 PCTFREE 0 INITRANS 1 MAXTRANS 255 NOLOGGING PARTITION BY RANGE (ID) ( PARTITION PART_2010 VALUES LESS THAN (10) NOLOGGING, PARTITION PART_2011 VALUES LESS THAN (20) NOLOGGING , PARTITION PART_2012 VALUES LESS THAN (MAXVALUE) NOLOGGING ) ENABLE ROW MOVEMENT; ALTER TABLE TBL_ORACLE ADD CONSTRAINT SAMPLE_PK PRIMARY KEY (ID); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 CREATE UNLOGGED TABLE TBL_ORACLE ( ID NUMBER ,Name VARCHAR2 (100) ,ADDRESS VARCHAR2 (200) /*,CONSTRAINT SAMPLE_PK PRIMARY KEY (ID)*/ ) TABLESPACE space1 /*PCTUSED 40*/ PCTFREE 0 INITRANS 1 MAXTRANS 255 PARTITION BY RANGE (ID) ( PARTITION PART_2010 VALUES LESS THAN (10) ,PARTITION PART_2011 VALUES LESS THAN (20) ,PARTITION PART_2012 VALUES LESS THAN (MAXVALUE) ) ENABLE ROW MOVEMENT ;
-
数据类型 删除数据类型中的BYTE关键字。 Oracle语法 迁移后语法 1 2 3 4 5 6 CREATE TABLE TBL_ORACLE ( ID Number, Name VARCHAR2(100 BYTE), ADDRESS VARCHAR2(200 BYTE) ); 1 2 3 4 5 6 CREATE TABLE TBL_ORACLE ( ID NUMBER ,Name VARCHAR2 (100) ,ADDRESS VARCHAR2 (200) ) ;
-
分区(注释分区) oracle配置参数中“#分区表唯一或主键约束”为“comment_partition”。 Oracle语法 迁移后语法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 CREATE TABLE TBL_ORACLE ( ID Number, Name VARCHAR2(100 BYTE), ADDRESS VARCHAR2(200 BYTE) ) TABLESPACE space1 PCTUSED 40 PCTFREE 0 INITRANS 1 MAXTRANS 255 NOLOGGING PARTITION BY RANGE (ID) ( PARTITION PART_2010 VALUES LESS THAN (10) NOLOGGING, PARTITION PART_2011 VALUES LESS THAN (20) NOLOGGING , PARTITION PART_2012 VALUES LESS THAN (MAXVALUE) NOLOGGING ) ENABLE ROW MOVEMENT; ALTER TABLE TBL_ORACLE ADD CONSTRAINT SAMPLE_PK PRIMARY KEY (ID); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 CREATE UNLOGGED TABLE TBL_ORACLE ( ID NUMBER ,Name VARCHAR2 (100) ,ADDRESS VARCHAR2 (200) ,CONSTRAINT SAMPLE_PK PRIMARY KEY (ID) ) TABLESPACE space1 /*PCTUSED 40*/ PCTFREE 0 INITRANS 1 MAXTRANS 255 /* PARTITION BY RANGE(ID)(PARTITION PART_2010 VALUES LESS THAN(10) , PARTITION PART_2011 VALUES LESS THAN(20) , PARTITION PART_2012 VALUES LESS THAN(MAXVALUE) ) ENABLE ROW MOVEMENT */ ;
-
PRIMARY KEY Oracle中如果存在两张表具有相同的主键字段,则在执行ALTER TABLE时需加上表名进行区分。 输入:PRIMARY KEY 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 CREATE TABLE CTP_ARM_CONFIG ( HOSTNAME VARCHAR2(50), OPNAME VARCHAR2(50), PA RAM TYPE VARCHAR2(2), PARAMVALUE NUMBER(*,0), MODIFYDATE DATE ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE( PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE SPMS_DATA ; ALTER TABLE CTP_ARM_CONFIG ADD CONSTRAINT PKCTP_ARM_CONFIG PRIMARY KEY (HOSTNAME, OPNAME) USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATIS TICS STORAGE( PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE SPMS_DATA ENABLE;
-
未创建索引 如果ALTER TABLE中使用了INDEX或STORAGE参数,需要删掉。需要在CREATE TABLE中添加约束。 输入:PRIMARY KEY 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 CREATE TABLE CTP_ARM_CONFIG ( HOSTNAME VARCHAR2(50), OPNAME VARCHAR2(50), PARAMTYPE VARCHAR2(2), PARAMVALUE NUMBER(*,0), MODIFYDATE DATE ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE( PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE SPMS_DATA ; ALTER TABLE CTP_ARM_CONFIG ADD CONSTRAINT PKCTP_ARM_CONFIG PRIMARY KEY (HOSTNAME, OPNAME) USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTI CS STORAGE( PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE SPMS_DATA ENABLE; 输出 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 CREATE TABLE CTP_ARM_CONFIG ( HOSTNAME VARCHAR2 (50) ,OPNAME VARCHAR2 (50) ,PARAMTYPE VARCHAR2 (2) ,PARAMVALUE NUMBER ( 38 ,0 ) ,MODIFYDATE DATE ,CONSTRAINT PKCTP_ARM_CONFIG PRIMARY KEY ( HOSTNAME ,OPNAME ) ) /*SEGMENT CREATION DEFERRED*/ /*PCTFREE 10*/ /*PCTUSED 0*/ /*INITRANS 1*/ /*MAXTRANS 255*/ /*NOCOMPRESS*/ /*LOGGING*/ /*STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)*/ /*TABLESPACE SPMS_DATA */ ;
更多精彩内容
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格