oracle建表sql转为mysql

CREATE TABLE "WJ_GLSJZD" 
   (	"ID" NVARCHAR2(32) NOT NULL ENABLE, 
	"YWID" NVARCHAR2(32), 
	"YWLX" NUMBER(2,0), 
	"LBBS" NVARCHAR2(200), 
	"LBMC" NVARCHAR2(200), 
	"DMMC" NVARCHAR2(200), 
	"DMBS" NVARCHAR2(200), 
	"SXH" NUMBER(3,0), 
	 CONSTRAINT "PK_WJ_GLSJZD" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;

CREATE UNIQUE INDEX "GQCG0207"."PK_WJ_GLSJZD" ON "GQCG0207"."WJ_GLSJZD" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;

COMMENT ON TABLE GQCG0207.WJ_GLSJZD IS '文件关联数据字典[WJ_GLSJZD]';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.ID IS '文件校验id';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.YWID IS '文件校验名称';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.YWLX IS '0-模板目录 1-模板类型';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.LBBS IS 'gg_dmlb.id';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.LBMC IS 'gg_dmlb.lbmc';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.DMMC IS 'gg_dmnr.dmmc';
COMMENT ON COLUMN GQCG0207.WJ_GLSJZD.DMBS IS 'gg_dmnr.dmbs'; 

以下是将Oracle的建表语句转换为MySQL的建表语句:

CREATE TABLE `WJ_GLSJZD` (
    `ID` VARCHAR(32) NOT NULL,
    `YWID` VARCHAR(32),
    `YWLX` INT(2),
    `LBBS` VARCHAR(200),
    `LBMC` VARCHAR(200),
    `DMMC` VARCHAR(200),
    `DMBS` VARCHAR(200),
    `SXH` INT(3),
    PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE INDEX `PK_WJ_GLSJZD` ON `WJ_GLSJZD` (`ID`);

ALTER TABLE `WJ_GLSJZD` COMMENT = '文件关联数据字典[WJ_GLSJZD]';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `ID` VARCHAR(32) COMMENT '文件校验id';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `YWID` VARCHAR(32) COMMENT '文件校验名称';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `YWLX` INT(2) COMMENT '0-模板目录 1-模板类型';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `LBBS` VARCHAR(200) COMMENT 'gg_dmlb.id';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `LBMC` VARCHAR(200) COMMENT 'gg_dmlb.lbmc';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `DMMC` VARCHAR(200) COMMENT 'gg_dmnr.dmmc';
ALTER TABLE `WJ_GLSJZD` MODIFY COLUMN `DMBS` VARCHAR(200) COMMENT 'gg_dmnr.dmbs';
请注意,MySQL使用的是反引号(`)而不是双引号(")来引用表名、列名和索引名。此外,MySQL不支持存储参数(如INITIAL、NEXT、MINEXTENTS等)和表空间(TABLESPACE)。因此,在转换过程中,这些参数和表空间相关的部分被省略。

你可能感兴趣的:(遇到的问题,oracle,sql,mysql)