Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Tables

Updated on 2022-08-16 GMT+08:00

GaussDB Keyword

If a keyword is used as a column name, quotes (") must be added, for example, "order".

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_bd2 
 ( 
 ORDER NUMBER(10), 
 USER varchar2(30), 
 DATE VARCHAR(10 
 );
CREATE TABLE tbl_bd2 
 ( 
 "ORDER" NUMBER(10), 
 "USER" varchar2(30),  
 "DATE" VARCHAR(10 
 );

Data Type (I)

LONG VARCHAR should be changed to CLOB.

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID VARCHAR(36), 
 NAME LONG VARCHAR 
 );
CREATE TABLE tbl_db2 
 ( 
 ID VARCHAR(36), 
 NAME CLOB 
 );

LONG VARGRAPHIC.

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID VARCHAR(36), 
 NAME LONG VARGRAPHIC 
 );
CREATE TABLE tbl_db2 
 ( 
 ID VARCHAR(36), 
 NAME CLOB  
 );

Foreign Key

Below attributes of Foreign key constraint should be commented:

  • ON UPDATE RESTRICT
  • ENFORCED
  • ENABLE QUERY OPTIMIZATION

    DB2 Syntax

    Syntax After Migration

    ALTER TABLE "SCH"."TBL_DB2" 
     ADD CONSTRAINT "Const_Name" FOREIGN KEY("ID") 
     REFRENCES "SCH"."TBL_DB2_1"("ID") 
     ON DELETE CASCADE 
     ON UPDATE RESTRICT 
     ENFORCED 
     ENABLE QUERY OPTIMIZATION;
    ALTER TABLE "SCH"."TBL_DB2" 
     ADD CONSTRAINT "Const_Name" FOREIGN KEY("ID") 
     REFRENCES "SCH"."TBL_DB2_1"("ID") 
     ON DELETE CASCADE 
     /*ON UPDATE RESTRICT 
     ENFORCED 
     ENABLE QUERY OPTIMIZATION*/;

Sequence

built-in auto-increment function.

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (   
       START WITH +1   
       INCREMENT BY +1   
       MINVALUE +1   
       MAXVALUE +9223372036854775807   
       NO CYCLE   
       CACHE 20   
       NO ORDER ) , 
 NAME VARCHAR2(50), 
 ORDER VARCHAR2(100) 
 ); 
 
 
CREATE SEQUENCE mseq_tbl_db2_id 
 START WITH +1 
 INCREMENT BY +1 
 MINVALUE +1 
 MAXVALUE +9223372036854775807 
 NOCYCLE 
 CACHE 20 
 NOORDER; 
 CREATE TABLE tbl_db2 
 ( 
 ID BIGINT NOT NULL DEFAULT mseq_tbl_db2_id.NEXTVAL, 
 NAME VARCHAR2(50), 
 "ORDER" VARCHAR2(100) 
 );

Tablespace

TABLESPACE for a table to be placed is specified with IN clause.

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID number(20) NOT NULL DEFAULT IDENTITY.NEXTVAL, 
 NAME VARCHAR2(50) 
 ) 
 IN tbs1 ; 
CREATE TABLE tbl_db2 
 ( 
 ID number(20) NOT NULL DEFAULT IDENTITY.NEXTVAL, 
 NAME VARCHAR2(50) 
 ) 
 TABLESPACE tbs1 ; 

Default

WITH DEFAULT is specified to specified DEFAULT value.

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 STATUS CHAR(1) WITH DEFAULT '0' 
 );
CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 STATUS CHAR(1) DEFAULT '0' 
 );

DEFAULT specified without value.

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 STATUS CHAR(1) WITH DEFAULT 
 );
CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 STATUS CHAR(1)  
 );

Data Type (II)

CLOB(1048576)

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 REMARKS CLOB(1048576));
CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 REMARKS CLOB 
 );

BLOB(2048000)

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 REMARKS BLOB(2048000) 
 );
CREATE TABLE tbl_db2 
 ( 
 ID number(20) , 
 NAME VARCHAR2(50), 
 REMARKS BLOB 
 );

LOB Options

LOGGED/UNLOGGED

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 "ID" number(20) , 
 "NAME" VARCHAR2(50), 
 "REMARKS" BLOB LOGGED 
 );
CREATE TABLE tbl_db2 
 ( 
 "ID" number(20) , 
 "NAME" VARCHAR2(50), 
 "REMARKS" BLOB /*LOGGED */  
 );

COMPACT/NOT COMPACT

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 "ID" number(20) , 
 "NAME" VARCHAR2(50), 
 "REMARKS" BLOB LOGGED NOT COMPACT 
 );
CREATE TABLE tbl_db2 
 ( 
 "ID" number(20) , 
 "NAME" VARCHAR2(50), 
 "REMARKS" BLOB /*LOGGED */ /* NOT COMPACT*/ 
 );

Organize By

Organize By

DB2 Syntax

Syntax After Migration

CREATE TABLE tbl_db2 
 ( 
 "ID" number(20) , 
 "NAME" VARCHAR2(50), 
 "REMARKS" BLOB 
 ) 
 IN tbs1 
 ORGANIZE BY ("ID","NAME");
CREATE TABLE tbl_db2 
 ( 
 "ID" number(20) , 
 "NAME" VARCHAR2(50), 
 "REMARKS" BLOB 
 ) 
 TABLESPACE tbs1 
 /*ORGANIZE BY ("ID","NAME")*/;

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback