HiveBrain v1.2.0
Get Started
← Back to all entries
snippetModerate

Oracle SQL create view privileges

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
createsqlprivilegesvieworacle

Problem

This is more of a theoritical question but I need help ASAP. Here it is:


With the appropriate use of SQL queries, grant as system
administrators the required access privileges to a database user named
STD01, so he can create a view of a table named CUSTOMER, which
belongs to another database user STD00.

Can anyone help me with this?

I know that I have to grant him with the system privilege of CREATE (ANY) VIEW and also give him all the object privileges (SELECT, INSERT, UPDATE & DELETE) on the CUSTOMER table, but I have no idea how can I do that by using SQL...

Solution

To grant privilege to create a view:

GRANT CREATE VIEW TO STD01;


To grant the DML privileges:

GRANT SELECT,UPDATE,INSERT,DELETE ON STD00.CUSTOMER TO STD01;


But that's not all of the object privileges. If you did:

GRANT ALL ON STD00.CUSTOMER TO STD01;


you would also give other privileges such as ALTER, INDEX, FLASHBACK, etc.

Code Snippets

GRANT CREATE VIEW TO STD01;
GRANT SELECT,UPDATE,INSERT,DELETE ON STD00.CUSTOMER TO STD01;
GRANT ALL ON STD00.CUSTOMER TO STD01;

Context

StackExchange Database Administrators Q#12064, answer score: 10

Revisions (0)

No revisions yet.