I’ve been reading about privileges and came across GRANT CREATE ANY VIEW TO
. What does the CREATE ANY VIEW TO actually do? Does it just create a view to a user?
The name of the privilege is actually CREATE ANY VIEW
, not CREATE ANY VIEW TO
.
First of all, this does not create a view. A privilege is a right to perform a specific type of operation (or a group of them), to access an object (or a group of them), and so on. You give (grant) a privilege to a user (grantee) with a command like :
GRANT <privilege> TO <user>
The CREATE ANY VIEW
privilege allows the grantee to create a view in any schema. By opposition, the CREATE VIEW
priviliege allows a user to create views only in its own schema.
From the Oracle docs :
To create a view in your own schema, you must have the
CREATE VIEW
system privilege. To create a view in another user's schema, you must have theCREATE ANY VIEW
system privilege