CREATE TABLE "CDR"."CIS_BLOOD_REQ_ORDER" ( "PLA_BRANCH_CODE" VARCHAR2(12) NOT NULL ENABLE, "REQUEST_NO" VARCHAR2(32) NOT NULL ENABLE, "SEQ" VARCHAR2(4) NOT NULL ENABLE, "PLAN_BLOOD_DATE" DATE NOT NULL ENABLE, "BLOOD_ORDER" VARCHAR2(16) NOT NULL ENABLE, "BLOOD_NUM" NUMBER(10,4) NOT NULL ENABLE, "UNIT" VARCHAR2(16) NOT NULL ENABLE, "BLOOD_PURPOSE" VARCHAR2(128) NOT NULL ENABLE, "REQ_DOCTOR" VARCHAR2(16) NOT NULL ENABLE, "STATE" VARCHAR2(4), "INVALID_EMPID" VARCHAR2(16), "INVALID_TIME" DATE, "ORDER_TYPE" VARCHAR2(16) NOT NULL ENABLE, "BLOOD_BAG_NO" VARCHAR2(32), "BLOOD_BAG_EFID" VARCHAR2(32), "NURSE1_SIGNATURE" VARCHAR2(16), "NURSE1_SIGNATURE_TIME" DATE, "NURSE2_SIGNATURE" VARCHAR2(16), "NURSE2_SIGNATURE_TIME" DATE, "RECEIVE_EMPID" VARCHAR2(16), "RECEIVE_TIME" DATE, "BACK_EMPID" VARCHAR2(16), "BACK_TIME" DATE, "RETURN_EMPID" VARCHAR2(16), "RETURN_TIME" DATE, "RETURN_REASON" VARCHAR2(128), "IS_IRRADIATION" VARCHAR2(4), "IS_MATCHING" VARCHAR2(4), "MODIFY_TIME" DATE, "OLD_ROWID" VARCHAR2(64), "BUSINESS_SYSTEM_ID" NUMBER(9,0), CONSTRAINT "CIS_BLOOD_REQ_ORDER_R01" PRIMARY KEY ("PLA_BRANCH_CODE", "REQUEST_NO", "SEQ", "BUSINESS_SYSTEM_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 "CDR" ENABLE ) 转hive语法
时间: 2023-07-19 21:47:32 浏览: 87
create table
5星 · 资源好评率100%
把Oracle的CREATE TABLE语句转换为Hive的CREATE TABLE语句如下:
CREATE TABLE `CDR`.`CIS_BLOOD_REQ_ORDER` (
`PLA_BRANCH_CODE` STRING NOT NULL,
`REQUEST_NO` STRING NOT NULL,
`SEQ` STRING NOT NULL,
`PLAN_BLOOD_DATE` DATE NOT NULL,
`BLOOD_ORDER` STRING NOT NULL,
`BLOOD_NUM` DECIMAL(10,4) NOT NULL,
`UNIT` STRING NOT NULL,
`BLOOD_PURPOSE` STRING NOT NULL,
`REQ_DOCTOR` STRING NOT NULL,
`STATE` STRING,
`INVALID_EMPID` STRING,
`INVALID_TIME` DATE,
`ORDER_TYPE` STRING NOT NULL,
`BLOOD_BAG_NO` STRING,
`BLOOD_BAG_EFID` STRING,
`NURSE1_SIGNATURE` STRING,
`NURSE1_SIGNATURE_TIME` DATE,
`NURSE2_SIGNATURE` STRING,
`NURSE2_SIGNATURE_TIME` DATE,
`RECEIVE_EMPID` STRING,
`RECEIVE_TIME` DATE,
`BACK_EMPID` STRING,
`BACK_TIME` DATE,
`RETURN_EMPID` STRING,
`RETURN_TIME` DATE,
`RETURN_REASON` STRING,
`IS_IRRADIATION` STRING,
`IS_MATCHING` STRING,
`MODIFY_TIME` DATE,
`OLD_ROWID` STRING,
`BUSINESS_SYSTEM_ID` DECIMAL(9,0)
)
PARTITIONED BY (`dt` STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
TBLPROPERTIES (
'orc.compress'='SNAPPY',
'orc.create.index'='true',
'orc.bloom.filter.columns'='PLA_BRANCH_CODE, REQUEST_NO, SEQ, BUSINESS_SYSTEM_ID',
'orc.bloom.filter.fpp'='0.05',
'orc.stripe.size'='67108864',
'orc.row.index.stride'='10000',
'orc.bloom.filter.write.version'='2'
);
注意:Hive不支持复合主键,我在上述语句中将复合主键改为了分区键+普通字段,其中分区键为dt。同时,还需要注意数据类型的转换。
阅读全文