Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Irsyad Jamal.

Asked: April 12, 2017 - 12:24 pm UTC

Last updated: April 12, 2017 - 2:59 pm UTC

Version: 12.1.0.2

Viewed 1000+ times

You Asked

Hi Tom, can I create multi users for one schema? With different restrictions each user. For example I have HR schema and have 3 users let's say userA, userB and userC. userA only have create view, select and update data grants. userB have all of userA's, insert and UTL_FILE grants and userC only has select data grants.

and Chris said...

Yes! Giving different privileges is kinda the point of having different users:

grant create session, create view to a identified by a;
grant create session to b identified by b;

grant select on hr.employees to b;

conn a/a

create or replace view v as 
  select * from dual;
select * from v;

DUMMY  
X   

select count(*) from hr.employees;

SQL Error: ORA-00942: table or view does not exist

conn b/b

create or replace view v as 
  select * from dual;

SQL Error: ORA-01031: insufficient privileges

select * from v;

SQL Error: ORA-00942: table or view does not exist

select count(*) from hr.employees;

COUNT(*)  
107 


Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library