oracel 建立視圖給某個用戶

 

 

-----建立表ide

create table t_stu(  
  stuid      number(10)   primary key,  
  stuname    varchar2(20) not null,  
  stusex     varchar2(4)  default '男' check(stusex in('男','女'))
);ui

select * from t_stutable

insert into t_stu(stuid,stuname,stusex) values(1,'李四','男');
insert into t_stu(stuid,stuname,stusex) values(2,'李四','男');
insert into t_stu(stuid,stuname,stusex) values(3,'李四','男');
insert into t_stu(stuid,stuname,stusex) values(4,'李四','男');select

------建立視圖
CREATE OR REPLACE VIEW view_sty
 AS
SELECT * from t_stu;權限

-----建立訪問視圖的用戶im

create user user01
identified by "user01";查詢

-------受權查詢權限給用戶tab

grant select on view_sty to user01; view

-----受權連接權限給用戶vi

grant connect to user01;

------新用戶登錄後查詢

select * from lbj.view_sty01;

相關文章
相關標籤/搜索