How can I give to user, execute another users's functions?

60,357
GRANT EXECUTE ANY PROCEDURE TO user;

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9013.htm#i2077938

will manage both functions and procedures. You can't grant that way to functions only...

EDIT

the other way (but you'll have to run it every time the other user will create a new function to get all the grants):

Run

select 'GRANT EXECUTE ON '||owner||'.'||object_name||' TO user;'
from all_objects
where owner = 'xxx'
and object_type='FUNCTION';

and copy-paste-execute the result...

or use a SP doing the same thing (cursor on the query and execute immediate in loop)

Share:
60,357
Ersin Gulbahar
Author by

Ersin Gulbahar

Technologies : Big Data, Informatica, Apache Hadoop, Apache Kafka, Confluent, Elasticsearch, Apache Sqoop, NoSql, Openshift Programming Languages : PYTHON, JAVA, T-SQL, PL-SQL, C#, Unity Databases : Oracle, MsSQL, Couchbase, HBASE, PostgreSQL, Vertica, Terradata, SAP Hana, MySQL Stackoverflow : https://stackoverflow.com/users/1332870/ersin-g%c3%bclbahar Dzone : https://dzone.com/users/4487476/ersingulbahar.html Github : https://github.com/ersingulbahar

Updated on July 09, 2022

Comments

  • Ersin Gulbahar
    Ersin Gulbahar almost 2 years

    I want to give privileges to a user to call a function another users function.

    I write this : GRANT EXECUTE ANY FUNCTION TO user;

    but it doesn't work.

    user need to call this:

    call XXX.YYY.AlterAllInvalidObjects(NULL,'PACKAGE BODY');
    

    but how can I give grant ?

    NOTE : I don't want to use : GRANT EXECUTE ON FUNCTION AlterAllInvalidObjects TO user; I need general solution not specific function name.