Oracle创建表、索引、主键、字段描述
时间:2022-03-10 18:11
-- 创建表 create table SX04_LBALANCE ( YEAR VARCHAR2(10) not null, PROGRAMNO VARCHAR2(40) not null, FDATE VARCHAR2(10) not null, FACCTcode VARCHAR2(50) not null, FCURcode VARCHAR2(3) not null, FAACCCREDIT NUMBER(19,4) default 0 not null, FAENDBAL NUMBER(19,4) default 0 not null, FISDETAIL NUMBER(3) not null ) --表所在表空间 tablespace ISTAUDIT pctfree 10 initrans 1 maxtrans 255 storage ( initial 152M minextents 1 maxextents unlimited ); -- 字段描述 comment on column SX04_LBALANCE.INPUT_DT is ‘数据日期‘; -- 添加主键 alter table SX04_LBALANCE add primary key (YEAR, PROGRAMNO, FACCTcode, FDATE) using index tablespace ISTAUDIT pctfree 10 initrans 2 maxtrans 255 storage ( initial 93M minextents 1 maxextents unlimited ); -- 创建索引 多个索引可连续创建 如下 create index code_INDEX on SX04_LBALANCE (FACCTcode) tablespace ISTAUDIT pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited ); create index FDATE_INDEX on SX04_LBALANCE (FDATE) tablespace ISTAUDIT pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited );
Oracle创建表、索引、主键、字段描述,布布扣,bubuko.com