-- 建表
create table tbl_person
(
id NUMBER not null,
name VARCHAR2(100),
sex INTEGER,
createtime VARCHAR2(100)
updatetime VARCHAR2(100)
)
--表空间参数
tablespace HAHA
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
-- 添加注释
comment on table ADMIN_DEV.tbl_person
is '人员表';
-- Add comments to the columns
comment on column ADMIN_DEV.tbl_person.id
is '主键id';
comment on column ADMIN_DEV.tbl_person.name
is '姓名';
comment on column ADMIN_DEV.tbl_person.sex
is '性别';
comment on column ADMIN_DEV.tbl_person.createtime
is '创建时间';
comment on column ADMIN_DEV.tbl_person.updatetime
is '更新时间';
-- Create/Recreate primary, unique and foreign key constraints
--创建约束
alter table tbl_person
add constraint tbl_person primary key (ID)
using index
tablespace OAPP_INDEX
pctfree 10
initrans 2
maxtrans 255;
--创建自增id
CREATE SEQUENCE tbl_person_ID MINVALUE 1 MAXVALUE 999999999999999999999999999 START WITH 1 INCREMENT BY 1 CACHE 20;
--创建索引
Create Index tbl_person on tbl_person(name);
--创建别名
CREATE SYNONYM ADMIN_DEV_R.tbl_person FOR ADMIN_DEV.tbl_person;
CREATE SYNONYM ADMIN_DEV_W.tbl_person FOR ADMIN_DEV.tbl_person;
CREATE SYNONYM ADMIN_DEV_W.tbl_person_ID FOR ADMIN_DEV.tbl_person_ID;
-- 赋权
grant select on ADMIN_DEV.FNA_REVENUE_BUDGET to ADMIN_DEV_R;
GRANT UPDATE ON "ADMIN_DEV"."tbl_person" TO "ADMIN_DEV_W";
GRANT SELECT ON "ADMIN_DEV"."tbl_person" TO "ADMIN_DEV_W";
GRANT INSERT ON "ADMIN_DEV"."tbl_person" TO "ADMIN_DEV_W";
GRANT DELETE ON "ADMIN_DEV"."tbl_person" TO "ADMIN_DEV_W";
GRANT ALTER ON "ADMIN_DEV"."tbl_person" TO "ADMIN_DEV_W";