Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

table level privileges

Posted on 2001-07-08
Last Modified: 2006-11-17
Normally we grant or revoke roles or privileges to/from a schema. Can we do the same to/from a table or any other object?
Question by:k_murli_krishna
  • 3
LVL 17

Author Comment

ID: 6262541
Please give me a detailed answer.

Accepted Solution

highmarks earned 50 total points
ID: 6262748
yes you can
grant select on table_name for user_name;
individual granting

Expert Comment

ID: 6263742
There are three types of privileges: system privileges, object privileges and role privileges.

A system privilege is a privilege to do something in the database - for example CREATE SESSION.  These privileges can be granted to users (ie. schemas) and/or roles.

An object privilege is a privilege to do something with regards to a particular database object - for example, to SELECT from a particular table, to INSERT into a particular table, to EXECUTE a particular procedure.These privileges can be granted only on a specific database object by users (schemas) with grant authority on them.  (A user can have grant authority by owning the object, or by having the privilege granted to him with the GRANT option.)  There is no statement that allows you to grant SELECT on all the tables in a particular schema to a particular user, you have to specify each table individually.  Also you cannot issue a default grant that applies to tables that haven't even been created yet.

Object privileges can be granted to users (schemas) or roles.

Role privileges (ie roles) can be granted to users or to other roles.

Where ever you might grant something to a user can also grant it to PUBLIC.  Then it becomes available to all the users, even those users that get created later will have the privilege.

When you grant a privilege through a role the user cannot use it to create a database object.  For example, suppose you have a table TAB_NEWS with fields ITEM, SEQID, TIMESTAMP, NEWSLINE and you grant SELECT on that TABLE to the role READ_NEWS.  Assume you have a public synonym for that table.  Then a user with that role can issue the command


that will show him the news from the last 3 days.  He cannot create a view LAST_3_DAYS with the command:


This is because the object (the view) would depend on a privilege he had through a role.

If you had granted SELECT on TAB_NEWS to PUBLIC, then he could have created the view.  However he could not have granted SELECT on his view to anyone else.  The only solution to that would be for you to grant SELECT on TAB_NEWS to PUBLIC with the GRANT option.  Then he could have granted SELECT on his view to other users.

Besides views this also applies to procedures, packages and functions.  However you do not have the option of granting a privilege to the object directly.  If you want user ABC to be able to create the view LAST_3_DAYS on your table, then you have to grant the privilege to the user, you cannot grant it specifically to the VIEW.  (And similarly you cannot grant object privileges directly to a PROCEDURE, PACKAGE or FUNCTION.)

LVL 17

Author Comment

ID: 6265111
Dear Mr. Highmarks,
                   If you would like more than allocated 50 points, please be elaborate like Mr. Marek_wiechula. He has given a comrehensive answer. But to my question, yours is a precise answer assuming i am good. But I have started off 5 months ago and for a weak case like me more upload is required. Anyway, thanx a ton, your answer was equally viable.

with regards
( K. Murli Krishna )
LVL 17

Author Comment

ID: 6265360
Dear Mr. Warek_wiechula,
                        I love you. You gave such a fantastic answer that i am dumbfounded. I have started off as oracle dba in effect 4 months back. I accepted Mr. Highmarks comment as a answer and graded him A with 50 unchanged points since he gave a very precise answer. I want to accept yours and give you 75 points but somehow that button stands disabled. My mailid is kmkrishna@dev.vsofti.stph.net.

with regards

( K. Murli Krishna )

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
selective queries 7 37
oracle- set role and grant privileges 6 38
Oracle DBLINKS From 11g to 8i 3 47
SQL Workhours Count beetween Workhours 3 25
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question