oracle数据库表,索引创建实例

-- Create table
create table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
(
  mmid         NUMBER(14),
  systemid     NUMBER(14),
  objectref    NUMBER(14),
  intid        VARCHAR2(20),
  issno        VARCHAR2(3),
  icn          VARCHAR2(100),
  format       VARCHAR2(50),
  defaulttitle VARCHAR2(500),
  wfstate      VARCHAR2(25),
  height       NUMBER(5),
  width        NUMBER(5),
  uom          VARCHAR2(10),
  imgarea      VARCHAR2(2),
  logo         CHAR(1),
  rfa          VARCHAR2(3999)
)
tablespace TS_LIFE
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 4M
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate indexes 
create index COR_DB_CSDB.CMMO_I1 on COR_DB_CSDB.CDM_MULTIMEDIAOBJ (SYSTEMID, UPPER(ICN))
  tablespace TS_LIFE_IDX
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 3M
    next 1M
    minextents 1
    maxextents unlimited
  );
create index COR_DB_CSDB.CMMO_IFK1 on COR_DB_CSDB.CDM_MULTIMEDIAOBJ (OBJECTREF)
  tablespace TS_LIFE_IDX
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 768K
    next 1M
    minextents 1
    maxextents unlimited
  );
create index COR_DB_CSDB.CMMO_IFK2 on COR_DB_CSDB.CDM_MULTIMEDIAOBJ (SYSTEMID)
  tablespace TS_LIFE_IDX
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 1M
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints 
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_PK primary key (MMID)
  using index 
  tablespace TS_LIFE_IDX
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 768K
    next 1M
    minextents 1
    maxextents unlimited
  );
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_UK1 unique (INTID, ISSNO)
  using index 
  tablespace TS_LIFE_IDX
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 2M
    next 1M
    minextents 1
    maxextents unlimited
  );
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_IFK1 foreign key (OBJECTREF)
  references COR_DB_CSDB.CDM_OBJECT (OBJECTREF);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_IFK2 foreign key (SYSTEMID)
  references COR_DB_CSDB.CDM_CSDB (SYSTEMID) on delete cascade;
-- Create/Recreate check constraints 
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_CHKIN_FMT
  check (Format IN ('ADI','BMP','CGM','DXF','FAX','FPX','GIF','GKS','JPG','MNG','PBM','PCX','PICT','PNG','RAS','SVG','TGA','TIFF','WMF','AIF','AIFC','AU','CDA','CDDA','KAR','M3U','M3URL','MID','MIDI','MP3','PLS','RMI','SMF','SND','SWA','ULW','WAV','WMA','DS-3DXML','ASM','CATDRAWING','CATPART','CATPRODUCT','CGR','CT','DCR','DRW','DWF','ED','EDZ','FRM','IGES','MODEL','PRT','RH','SLDASM','SLDDRW','SLDPRT','STEP','SWF','U3D','UGS','W3D','WRL','X3D','XV0','XV2','XV3','XVL','ASF','ASR','ASX','AVI','DIF','DV','FLA','FLI','FLV','MHEG','MLV','MOV','MP2','MP2V','MP4','MPE','MPEG-1','MPEG-2','MPG','MPG4','QT','QTR','QTX','RA','RAM','RGB','RM','RMJ','RTS','RTSP','SDP','SMI','SML','VFW','WM','WMP','WMV','WMX','VSD','DOC','MDB','MPP','PDF','PPS','PPT','SDR','SMIL','XLS','DWG','AT_DG','AT_DX','AT_DC','AT','TIF','CG4','EPS','SMG','CDR'));
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_CHKIN_IA
  check (ImgArea IN ('AP','BP','CP','DL','EL','FP','GP','HL','IL'));
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_CHKIN_LOG
  check (Logo IN ('Y','N'));
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_CHKIN_UOM
  check (UOM IN ('mm','cm','in','pix'));
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_FMT
  check ("FORMAT" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_ICN
  check ("ICN" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_IID
  check ("INTID" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_IN
  check ("ISSNO" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_LOG
  check ("LOGO" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_MMI
  check ("MMID" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_SID
  check ("SYSTEMID" IS NOT NULL);
alter table COR_DB_CSDB.CDM_MULTIMEDIAOBJ
  add constraint CMMO_NN_WS
  check ("WFSTATE" IS NOT NULL);
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值