Grant privileges for an Oracle package?

mcvkr picture mcvkr · May 22, 2017 · Viewed 54.3k times · Source

I have a package A, which uses some variables and procedures in another package B in the same schema. Now I want to move package A to a new schema. What privileges should I grant to the new schema for using the package B same way? What is the grant statement for that ?

Answer

JohnHC picture JohnHC · May 22, 2017

Use GRANT to give execute privileges

grant execute on PACKAGE_B to new_schema;

Then, you need to ensure that any reference in package A includes the full path:

PACKAGE_B.SOME_PROC

It might be worth creating a public synonym in for the package, so that you can avoid referencing the schema too.