首页 > 代码库 > Oracle创建表、索引、主键、字段描述

Oracle创建表、索引、主键、字段描述

-- 创建表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  );