how to grant privilega on stored procedures and a single table

I have a schema/user whose name is say XYZ needs to access  another user (say ABC)stored procedure ,single table alone. How i can i grant those privileges on user/schema xyz. Any ideas, syntax,code,links, resources highly appreciated. Thanks in advance
LVL 7
gudii9Asked:
Who is Participating?
 
sdstuberConnect With a Mentor Commented:
log in as ABC or as a user with "grant any object privilege" authority

grant execute on abc.your_procedure to xyz.

grant select on abc.your_table to xyz
0
 
gudii9Author Commented:
you mean to say i need to login to user ABC and execute the command
"grant any object privilege"when i execute it is showing any word and saying
ORA-00990:missing or invalid privilege
From same ABC user
I was able to execute commands:
grant execute on abc.procedure_name to xyz
but i was not able to execute:
grant select on abc.table_name to xyz (saying table or view does not exist)
How shall i grant privelege to table also

0
 
DavidConnect With a Mentor Senior Oracle Database AdministratorCommented:
Assuming that user or role xyz exists, and that your table or view does exist (select table_name from user_tables), and as user ABC, try without the owner prefix: "grant select on table_x to xyz;"
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
sdstuberConnect With a Mentor Commented:
are you sure you don't have a misspelled table name?

grant select on abc.table_name to xyz


that is correct syntax.

is your table name mixed or lower case? If so, you'll have to put it in double quotes

grant select on abc."table_name" to xyz
0
 
sathyagiriConnect With a Mentor Commented:
Login as user ABC, then execute the following

GRANT SELECT ON <TABLE_NAME> TO XYZ;

GRANT EXECUTE ON <STORED_PROC NAME> TO XYZ;

Then login as user XYZ and
select * from abc.<TABLE_NAME>;
execute ABC.<SPROC_NAME>;

If you do not want to suffix the owner name , then create a synonym for the table and stored proc

CREATE SYNONYM <TABLE_NAME> FOR ABC.<TABLE_NAME>;
CREATE SYNONYM <SPROC_NAME> FOR ABC.<SPROC_NAME>;

Now you can directly access the table and sproc with out prefixing the owner name.



0
 
sdstuberConnect With a Mentor Commented:
"you mean to say i need to login to user ABC and execute the command
"grant any object privilege"when i execute it is showing any word and saying
ORA-00990:missing or invalid privilege
"

what I meant was ABC can grant access to its own objects

Other users can also grant access to ABC's objects provided those users have authority to "grant any object privilege" that entire phrase is the name of the privilege.

If you wanted to be able to do that you would do

grant grant any object privilege to some_user

most users do not have authority to grant that privilege.

however, if you're logging in as ABC, you don't need that authority because it's implicit in being the object owner.


0
 
gudii9Author Commented:
thank you very much for your help. I appreciate it.
0
 
sdstuberCommented:
glad we could help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.