Oracle - Create table and index

spool DB_Table.log

create table SAMPLEUSER.MY_DUAL
(
X NUMBER not null,
primary key (X)
)
organization index;

create table SAMPLEUSER.TB_IEM902
(
PLANT_CD VARCHAR2(4) not null,
MANA_NO VARCHAR2(18) not null,
MANA_NM VARCHAR2(50),
USE_YN VARCHAR2(1) default 'N',
MANA_NM_ENG VARCHAR2(50),
INSERT_DATE DATE default SYSDATE,
INSERT_USER VARCHAR2(20),
UPDATE_DATE DATE default SYSDATE,
UPDATE_USER VARCHAR2(20),
DEL_FLAG VARCHAR2(1) default 'A' not null,
LEVEL_CD VARCHAR2(30),
UPDATE_DATE1 VARCHAR2(14),
TYPE VARCHAR2(4)
)
tablespace SAMPLEUSER_TABLE
pctfree 20
initrans 1
maxtrans 255
storage
(
initial 1M
minextents 1
maxextents unlimited
);
comment on table SAMPLEUSER.TB_IEM902
is '관리코드정보';
alter table SAMPLEUSER.TB_IEM902
add constraint TB_IEM902_PK primary key (PLANT_CD, MANA_NO)
using index
tablespace SAMPLEUSER_TABLE
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
create index SAMPLEUSER.TB_IEM902_X1 on SAMPLEUSER.TB_IEM902 (PLANT_CD)
tablespace SAMPLEUSER_INDEX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 4M
next 16K
minextents 1
maxextents unlimited
pctincrease 0
);
create index SAMPLEUSER.TB_IEM902_X2 on SAMPLEUSER.TB_IEM902 (PLANT_CD, LEVEL_CD)
tablespace SAMPLEUSER_TABLE
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
grant select, insert, update, delete, references, index on SAMPLEUSER.TB_IEM902 to IEOPT;
grant select, insert, update, delete, references, index on SAMPLEUSER.TB_IEM902 to SAMPLEUSEROC;


spool off

댓글 없음:

댓글 쓰기