oracle multi user function

前端 未结 1 1321
执笔经年
执笔经年 2021-01-24 17:29

How can I create a function that I can use from different users? It must work like built-in oracle function, which can be called from any user. I guess that this can be achieved

相关标签:
1条回答
  • 2021-01-24 18:14

    This should do it for specific users:

    GRANT EXECUTE ON your_function TO some_user;
    

    You can allow access to all users this way:

    GRANT EXECUTE ON your_function TO PUBLIC;
    

    To reference this function from another users account, do this:

    SELECT owner.your_function FROM dual;
    

    If you want to avoid specifying the owning schema in the function reference, create a public synonym for it:

    CREATE PUBLIC SYNONYM your_function FOR owner.your_function;
    

    Then anyone can reference the function this way:

    SELECT your_function FROM dual;
    
    0 讨论(0)
提交回复
热议问题