oracle的建表过程

时间:2022-12-29 08:37:04

1.创建表语句

create table HFDATA.T_CAS_INFO(
	ID    varchar2(20) default sys_guid() not null,
	NAME  varchar2(50) 
)tablespace HFDATA initrans 6;

comment on table HFDATA.T_CAS_INFO is '基本信息表';
comment on table HFDATA.T_CAS_INFO.ID is '主键';
comment on table HFDATA.T_CAS_INFO.NAME is '姓名';

2.创建索引

create unique index HFDATA.PK_INDEX_CAS_INFO on HFDATA.T_CAS_INFO(ID) initrans 16;
alter table HFDATA.T_CAS_INFO add constraint PK_INDEX_CAS_INFO primary key(ID) using index HFDATA.PK_INDEX_CAS_INFO;

3.创建同义词

create public synonym T_CAS_INFO for HFDATA.T_CAS_INFO;

4.赋权

grant select on HFDATA.T_CAS_INFO to R_HFDATA_QRY
grant select on HFDATA.T_CAS_INFO to R_HFDATA_DEV_QRY
grant select,insert,update,delete on HFDATA.T_CAS_INFO to R_HFDATA_DML;