把其中的Oracle语句转换为MySQL语句
时间: 2024-11-03 15:22:00 浏览: 22
将Oracle SQL语句转换为MySQL语句时,需要注意以下几点:
1. **数据类型**:Oracle和MySQL的数据类型有所不同,需要进行相应的转换。
2. **日期格式**:Oracle使用`DATE`类型,而MySQL也支持`DATE`类型,但语法可能略有不同。
3. **字符串类型**:Oracle中的`NVARCHAR2`在MySQL中通常对应`VARCHAR`或`NVARCHAR`。
4. **默认值**:Oracle和MySQL都支持默认值,但语法可能稍有不同。
5. **主键约束**:Oracle和MySQL都支持主键约束,但语法可能稍有不同。
6. **索引创建**:Oracle和MySQL都支持索引创建,但语法可能稍有不同。
以下是将文档中的Oracle SQL语句转换为MySQL语句的结果:
### 表 `T_MBT_AUTO_TASK`
```sql
DROP TABLE IF EXISTS T_MBT_AUTO_TASK;
CREATE TABLE T_MBT_AUTO_TASK (
ID BIGINT NOT NULL,
BRANCH_ID BIGINT,
CHECKFAILNUM INT DEFAULT 0,
CHECKRANGE INT,
CHECKSUCCESSNUM INT DEFAULT 0,
CREATEDBY VARCHAR(64),
CREATEDTIME DATETIME NOT NULL,
CRONEXP VARCHAR(50),
CRONEXPRESSION VARCHAR(20),
ENDREPORTDATE VARCHAR(10),
ENDRUNDATE DATETIME,
END_TIME DATETIME,
FAILNUM INT DEFAULT 0,
FAILUREREASONS VARCHAR(255),
INVALID INT DEFAULT 0 NOT NULL,
LASTMODIFIEDBY VARCHAR(64),
LASTMODIFIEDTIME DATETIME NOT NULL,
NAME VARCHAR(64),
REMARKS MEDIUMTEXT,
RUNSTATUS INT,
SCHEDULING_MODE VARCHAR(10),
STARTREPORTDATE VARCHAR(10),
STARTRUNDATE DATETIME,
START_TIME DATETIME,
SUCCESSNUM INT DEFAULT 0,
SYS_FIELD TINYINT,
TASKTYPE VARCHAR(20),
TIME_INTERVAL INT,
TRIGGERTYPE INT,
HOLIDAYEXE VARCHAR(1),
BRANCH_ID_SELECTED VARCHAR(2000),
CREDIT_CODE VARCHAR(255),
BUSINESSTYPE VARCHAR(20),
PRIMARY KEY (ID)
);
```
### 表 `T_MBT_AUTO_TASK_HIS`
```sql
DROP TABLE IF EXISTS T_MBT_AUTO_TASK_HIS;
CREATE TABLE T_MBT_AUTO_TASK_HIS (
ID BIGINT NOT NULL,
BRANCH_ID BIGINT,
CHECKFAILNUM INT DEFAULT 0,
CHECKRANGE INT,
CHECKSUCCESSNUM INT DEFAULT 0,
CREATEDBY VARCHAR(64),
CREATEDTIME DATETIME NOT NULL,
CREATED_TIME_STR VARCHAR(15),
CRON_EXPRESSION VARCHAR(20),
ENDREPORTDATE DATETIME,
ENDRUNDATE DATETIME,
FAILNUM INT DEFAULT 0,
FAILURE_REASONS VARCHAR(255),
INVALID INT DEFAULT 0 NOT NULL,
LASTMODIFIEDBY VARCHAR(64),
LASTMODIFIEDTIME DATETIME NOT NULL,
NAME VARCHAR(64),
RUNSTATUS INT,
STARTREPORTDATE DATETIME,
STARTRUNDATE DATETIME,
SYS_FIELD TINYINT,
SUCCESSNUM INT DEFAULT 0,
TASKID BIGINT,
PRIMARY KEY (ID)
);
```
### 表 `T_MBT_LIMIT_INFO`
```sql
DROP TABLE IF EXISTS T_MBT_LIMIT_INFO;
CREATE TABLE T_MBT_LIMIT_INFO (
ID BIGINT NOT NULL,
ACTION_TYPE VARCHAR(1),
BRANCH_ID BIGINT,
CREATEDBY VARCHAR(64),
CREATEDTIME DATETIME NOT NULL,
DATA_SOURCE INT,
DATA_STATUS INT,
INVALID INT DEFAULT 0 NOT NULL,
LASTMODIFIEDBY VARCHAR(64),
LASTMODIFIEDTIME DATETIME NOT NULL,
REPORTFILE VARCHAR(34),
AUTHLIMITTYPE INT,
CONEFFDATE DATETIME,
CONEXPDATE DATETIME,
CONSTATUS INT,
CONTRACTID BIGINT,
CREDITLIMIT BIGINT,
CREDITLIMITNUM VARCHAR(60),
CY VARCHAR(3),
LIMLOOPFLG INT,
GUARLIMIT BIGINT,
LIMITTYPE INT,
CREDIT_CODE VARCHAR(255),
BAR_CODE VARCHAR(255),
PRIMARY KEY (ID)
);
```
### 表 `T_MBT_ACC_INFO`
```sql
DROP TABLE IF EXISTS T_MBT_ACC_INFO;
CREATE TABLE T_MBT_ACC_INFO (
ID BIGINT NOT NULL,
ACTION_TYPE VARCHAR(1),
BRANCH_ID BIGINT,
CREATEDBY VARCHAR(64),
CREATEDTIME DATETIME NOT NULL,
CHANGESTATUS INT,
DATA_SOURCE INT,
DATA_STATUS INT,
INVALID INT DEFAULT 0 NOT NULL,
LASTMODIFIEDBY VARCHAR(64),
LASTMODIFIEDTIME DATETIME NOT NULL,
REPORTFILE VARCHAR(34),
CHECKBY VARCHAR(64),
CHECKTIME DATETIME,
LIST_ACTION_TYPE VARCHAR(1),
LIST_CONTENT MEDIUMTEXT,
LIST_DATA_STATUS INT,
LISTREPORTFILE VARCHAR(34),
REFUSEREASON VARCHAR(500),
RESETBY VARCHAR(64),
RESETREASON VARCHAR(500),
RESETTIME DATETIME,
SUBMITBY VARCHAR(64),
SUBMITTIME DATETIME,
ACCTCODE VARCHAR(60),
ACCTTYPE VARCHAR(2),
IDNAME VARCHAR(80),
IDNUM VARCHAR(40),
IDTYPE VARCHAR(2),
MNGMTORGCODE VARCHAR(14),
ORGACCTCODE VARCHAR(60),
REPORTDATE DATETIME,
REPORTPOINT INT,
ISREPORT INT,
CUSTOMER_NUM VARCHAR(60),
CREDIT_CODE VARCHAR(255),
BAR_CODE VARCHAR(255),
LIS_INFO_ACTION INT,
ISLISCOPY INT,
FORCE_SUBMIT INT DEFAULT 0,
PRIMARY KEY (ID)
);
CREATE INDEX ACCTCODE_IDX ON T_MBT_ACC_INFO (ACCTCODE);
CREATE INDEX ACCTTYPE_IDX ON T_MBT_ACC_INFO (ACCTTYPE);
```
### 表 `T_MBT_LOAN_BASIS_INFO`
```sql
DROP TABLE IF EXISTS T_MBT_LOAN_BASIS_INFO;
CREATE TABLE T_MBT_LOAN_BASIS_INFO (
ID BIGINT NOT NULL,
ACTION_TYPE VARCHAR(1),
BRANCH_ID BIGINT,
CREATEDBY VARCHAR(64),
CREATEDTIME DATETIME NOT NULL,
DATA_SOURCE INT,
UPLOADERR VARCHAR(128),
UPLOADSTATUS INT,
EXPORTCOUNT INT,
REPORTDATE DATETIME,
FEEDBACKDATE DATETIME,
FEEDBACK_CREATED_DATE DATETIME,
UPLOAD_CODE VARCHAR(255),
CREDIT_CODE VARCHAR(255),
DATAFROM INT,
TXTDOWNLOADSTATUS INT,
ENCDOWNLOADSTATUS INT,
UPLOADWAY VARCHAR(4),
FEEDBACKWAY VARCHAR(4),
REPORTFILENAME VARCHAR(34),
REPORTFILECREATEDDATE DATETIME,
FEEDBACKFILENAME VARCHAR(100),
FILENAME VARCHAR(100),
FILEIMPORTDATE DATETIME,
FILECREATEDDATE VARCHAR(100),
FEEDBACKFILECREATEDDATE DATETIME,
FEEDBACKDOWNLOADSTATUS BIGINT,
SAVESTATUS INT,
CONSTRAINT SYS_C007694 CHECK (ID IS NOT NULL),
CONSTRAINT SYS_C007695 CHECK (CREATEDTIME IS NOT NULL),
CONSTRAINT SYS_C007696 CHECK (INVALID IS NOT NULL),
PRIMARY KEY (ID)
);
```
### 表 `T_MBT_ENTERPRISE_OTH_ID_BACK`
```sql
DROP TABLE IF EXISTS T_MBT_ENTERPRISE_OTH_ID_BACK;
CREATE TABLE T_MBT_ENTERPRISE_OTH_ID_BACK (
ID BIGINT,
ACTION_TYPE VARCHAR(1),
BRANCH_ID BIGINT,
CREATEDBY VARCHAR(64),
CHANGESTATUS INT,
CREATEDTIME DATETIME NOT NULL,
DATA_SOURCE INT,
DATA_STATUS INT,
INVALID INT DEFAULT 0 NOT NULL,
LASTMODIFIEDBY VARCHAR(64),
LASTMODIFIEDTIME DATETIME NOT NULL,
REPORTFILE VARCHAR(34),
CHECKBY VARCHAR(64),
CHECKTIME DATETIME,
LIST_ACTION_TYPE VARCHAR(1),
LIST_CONTENT MEDIUMTEXT,
LIST_DATA_STATUS INT,
LISTREPORTFILE VARCHAR(34),
REFUSEREASON VARCHAR(500),
RESETBY VARCHAR(64),
RESETREASON VARCHAR(500),
RESETTIME DATETIME,
SUBMITBY VARCHAR(64),
SUBMITTIME DATETIME,
ENTCERTNUM VARCHAR(40),
ENTCERTTYPE VARCHAR(255),
ENTNAME VARCHAR(80),
ENTERPRISEID BIGINT,
IDTAG VARCHAR(255),
INFOUPDATE DATETIME,
OTHENTCERTNUM VARCHAR(40),
OTHENTCERTTYPE VARCHAR(255),
REPORTDATE DATETIME,
TBOPTION INT,
ISREPORT INT,
INFSURCCODE VARCHAR(20),
CUSTOMER_NUM VARCHAR(60),
OLD_ID BIGINT NOT NULL,
BATCH_NUM BIGINT,
CREDIT_CODE VARCHAR(255),
BAR_CODE VARCHAR(255),
PRIMARY KEY (ID)
);
```
### 表 `T_MBT_ENT_RELATION_BACK`
```sql
DROP TABLE IF EXISTS T_MBT_ENT_RELATION_BACK;
CREATE TABLE T_MBT_ENT_RELATION_BACK (
ID BIGINT,
OLD_ID BIGINT NOT NULL,
ACTION_TYPE VARCHAR(1),
BRANCH_ID BIGINT,
CREATEDBY VARCHAR(64),
CHECKMODULE VARCHAR(100) NOT NULL,
TASKNAME VARCHAR(255),
QUALITYREPORTFM VARCHAR(255),
QUALITYREPORTERRTAILFM VARCHAR(255),
BRANCHIDSELECTED VARCHAR(100) NOT NULL,
VERIFYRULESNUM INT,
CHECKTOTAL INT,
CALIBRATIONTASKEXEHIS BIGINT,
SELFREPORTSTATUS VARCHAR(20),
QUALITYREPORTPATH VARCHAR(255),
QUALITYREPORTERRTAILPATH VARCHAR(255),
QUALITYREPORTHTMLPATH VARCHAR(255),
REPORTNM VARCHAR(255),
PRIMARY KEY (ID)
);
```
### 表 `T_AML_MODELCHANGELOG`
```sql
DROP TABLE IF EXISTS T_AML_MODELCHANGELOG;
CREATE TABLE T_AML_MODELCHANGELOG (
ID BIGINT NOT NULL,
CHANGEDPROS VARCHAR(2000),
CLASSNAME VARCHAR(255),
MODELID BIGINT,
PRIMARY KEY (ID)
);
```
### 表 `T_BASE_MODELPROPDICT`
```sql
DROP TABLE IF EXISTS T_BASE_MODELPROPDICT;
CREATE TABLE T_BASE_MODELPROPDICT (
ID BIGINT NOT NULL,
TABLENAME VARCHAR(255),
FIELD VARCHAR(255),
KE VARCHAR(255),
ORDER_ATTR INT,
VALU VARCHAR(255),
PRIMARY KEY (ID)
);
```
### 表 `T_BASE_TASKJOBINFO`
```sql
DROP TABLE IF EXISTS T_BASE_TASKJOBINFO;
CREATE TABLE T_BASE_TASKJOBINFO (
BATCH_ID VARCHAR(64) NOT NULL,
JOB_DATA MEDIUMTEXT,
DATE_CREATE DATETIME,
DATE_UPDATE DATETIME,
JOB_GROUP VARCHAR(200),
JOB_NAME VARCHAR(100),
JOB_RESULT MEDIUMTEXT,
JOB_STATUS SMALLINT,
PRIMARY KEY (BATCH_ID)
);
```
### 表 `T_BASE_TASKJOBOWNER`
```sql
DROP TABLE IF EXISTS T_BASE_TASKJOBOWNER;
CREATE TABLE T_BASE_TASKJOBOWNER (
ID BIGINT NOT NULL,
BATCH_ID VARCHAR(64),
USERNAME VARCHAR(64),
PRIMARY KEY (ID)
);
```
### 表 `T_BIZ_INFO_SNAPSHOT`
```sql
DROP TABLE IF EXISTS T_BIZ_INFO_SNAPSHOT;
CREATE TABLE T_BIZ_INFO_SNAPSHOT (
ID BIGINT NOT NULL,
BRANCH_ID BIGINT,
CREATEDBY VARCHAR(64),
CREATEDTIME DATETIME NOT NULL,
INVALID INT DEFAULT 0 NOT NULL,
LIST_ACTION_TYPE VARCHAR(1),
LIST_DATA_STATUS INT,
LISTREPORTFILE VARCHAR(34),
ACCTCODE VARCHAR(60),
ACCTTYPE VARCHAR(2),
IDNAME VARCHAR(80),
IDNUM VARCHAR(40),
IDTYPE VARCHAR(2),
MNGMTORGCODE VARCHAR(14),
REPORTDATE DATETIME,
REPORTPOINT INT,
ISREPORT INT,
CREDIT_CODE VARCHAR(255),
BAR_CODE VARCHAR(255),
BUSIDTLLINES VARCHAR(2),
BUSILINES VARCHAR(2),
OPENDATE DATETIME,
CY VARCHAR(3),
ACCTCREDLINE BIGINT,
LOANAMT BIGINT,
DUEDATE DATETIME,
ACCTBAL BIGINT,
LASTEXPENSEISNULL VARCHAR(1),
TOWYFINREPORT VARCHAR(1),
TOWYDEBTISNULL VARCHAR(1),
TOWYPROFITISNULL VARCHAR(1),
TOWYCASHISNULL VARCHAR(1),
TOWYUNITISNULL VARCHAR(1),
TOWYEXPENSEISNULL VARCHAR(1),
ISEXISTDEBT VARCHAR(1),
ISEXISTPROFIT VARCHAR(1),
ISEXISTCASH VARCHAR(1),
ISEXISTUNIT VARCHAR(1),
ISEXISTEXPENSE VARCHAR(1),
AUTHLIMITTYPE INT,
SHEETYEAR YEAR,
SHEETVERSION TINYINT,
SHEETTYPEDIVIDE TINYINT,
SHEETTYPE SMALLINT,
SECDEP SMALLINT,
REGADD VARCHAR(80),
OTHREPYGUARWAY TINYINT,
ORGTYPE VARCHAR(2),
NATIONALITY VARCHAR(3),
INFOUPDATE DATETIME,
GUARMODE SMALLINT,
FINANCEREPORTDATE DATETIME,
ETPSTS VARCHAR(1),
ENTSCALE VARCHAR(1),
ECOTYPE INT,
ECOINDUSCATE VARCHAR(50),
CUSTOMERTYPE VARCHAR(1),
CUSTOMERREPORTDATE DATETIME,
CIMOC VARCHAR(14),
BIZENDDATE DATETIME,
ACCTSTATUS INT,
ISOPENCUSTOMER VARCHAR(1),
ISSETTLECUSTOMER VARCHAR(1),
PRIMARY KEY (ID)
);
```
### 表 `T_SYSTEM_APPCFG`
```sql
DROP TABLE IF EXISTS T_SYSTEM_APPCFG;
CREATE TABLE T_SYSTEM_APPCFG (
KEY_ VARCHAR(255) NOT NULL,
DESC_ VARCHAR(255),
VALUE_ VARCHAR(255),
PRIMARY KEY (KEY_)
);
```
### 表 `T_SYSTEM_LOCALE`
```sql
DROP TABLE IF EXISTS T_SYSTEM_LOCALE;
CREATE TABLE T_SYSTEM_LOCALE (
ID BIGINT NOT NULL,
LOCALE VARCHAR(255),
NAME VARCHAR(255),
VAL VARCHAR(500),
PRIMARY KEY (ID)
);
```
### 表 `T_SYSTEM_TABLETMPL`
```sql
DROP TABLE IF EXISTS T_SYSTEM_TABLETMPL;
CREATE TABLE T_SYSTEM_TABLETMPL (
ID BIGINT NOT NULL,
CREATEDBY INT,
CREATEDTIME DATETIME,
LASTMODIFIEDBY INT,
LASTMODIFIEDTIME DATETIME,
CONFIG MEDIUMTEXT,
EDITABLEFIELDS VARCHAR(255),
FILENAME VARCHAR(255),
IGNOREVIEWFIELDS VARCHAR(255),
MD5CODE VARCHAR(255),
MODULEKEY VARCHAR(255),
NAME VARCHAR(255),
TABLEALIAS VARCHAR(255),
USERID BIGINT,
VISIABLEFIELDS VARCHAR(255),
APPNAME VARCHAR(255),
PRIMARY KEY (ID)
);
```
### 表 `T_SYSTEM_TABLE_ATTR_ORDER`
```sql
DROP TABLE IF EXISTS T_SYSTEM_TABLE_ATTR_ORDER;
CREATE TABLE T_SYSTEM_TABLE_ATTR_ORDER (
ID BIGINT NOT NULL,
FILENAME VARCHAR(255),
TABLEATTRS VARCHAR(2000),
USERID BIGINT,
PRIMARY KEY (ID)
);
```
### 表 `T_WORKFLOW_CONFIG`
```sql
DROP TABLE IF EXISTS T_WORKFLOW_CONFIG;
CREATE TABLE T_WORKFLOW_CONFIG (
ID VARCHAR(255) NOT NULL,
CONFIG_DATA MEDIUMTEXT,
NAME VARCHAR(64),
PRIMARY KEY (ID)
);
```
### 表 `T_WORKFLOW_JOB`
```sql
DROP TABLE IF EXISTS T_WORKFLOW_JOB;
CREATE TABLE T_WORKFLOW_JOB (
ID VARCHAR(36) NOT NULL,
CURJOBSTATE VARCHAR(50),
CUROWNER VARCHAR(50),
FLOWID VARCHAR(50),
LOCKED_ TINYINT,
STARTSTATE VARCHAR(50),
TARGET VARCHAR(50),
PRIMARY KEY (ID)
);
```
### 表 `T_WORKFLOW_JOBSTATE`
```sql
DROP TABLE IF EXISTS T_WORKFLOW_JOBSTATE;
CREATE TABLE T_WORKFLOW_JOBSTATE (
ID VARCHAR(36) NOT NULL,
COMMENTS VARCHAR(255),
DATECREATE DATETIME,
IDTO VARCHAR(36),
JOBID VARCHAR(36),
OWNER VARCHAR(50),
STATE VARCHAR(50),
WORKER VARCHAR(50),
PRIMARY KEY (ID)
);
```
### 视图 `V_MBT_SELECTENTERPRISE`
```sql
CREATE OR REPLACE VIEW V_MBT_SELECTENTERPRISE AS
SELECT
ID, ACTION_TYPE, BRANCH_ID, CREATEDBY, CREATEDTIME, DATA_SOURCE, DATA_STATUS, INVALID, LASTMODIFIEDBY, LASTMODIFIEDTIME, REPORTFILE, CHANGESTATUS, CHECKBY, CHECKTIME, LIST_ACTION_TYPE, LIST_CONTENT, LIST_DATA_STATUS, LISTREPORTFILE, REFUSEREASON, RESETBY, RESETREASON, RESETTIME, SUBMITBY, SUBMITTIME, ADMDIVOFREG,
阅读全文