-----创建表
create table t_stu(
stuid number(10) primary key,
stuname varchar2(20) not null,
stusex varchar2(4) default '男' check(stusex in('男','女'))
);
select * from t_stu
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,'李四','男');
------创建视图
CREATE OR REPLACE VIEW view_sty
AS
SELECT * from t_stu;
-----创建访问视图的用户
create user user01
identified by "user01";
-------授权查询权限给用户
grant select on view_sty to user01;
-----授权链接权限给用户
grant connect to user01;
------新用户登陆后查询
select * from lbj.view_sty01;