From Oracle R12.2.X release we can use the below Oracle
recommended API/package to give grants on objects in APPS schema
exec AD_ZD.GRANT_PRIVS( X_PERMISSIONS ,
X_OBJECT_NAME,
X_GRANTEE ,
X_OPTIONS,
X_GRANT_TO_TABLE)
- X_PERMISSIONS:-
refer to permissions to be granted like SELECT, INSERT, EXECUTE etc.
- X_OBJECT_NAME:-
refers to the object name from APPS schema for which Grants would be
given. Like the table name, view name. package name etc.
- X_GRANTEE:
Refers to Grantee or schema to which grants would be given. Like Custom
schema
- X_OPTIONS:
Refers to Grant option, Default value is NULL
- X_GRANT_TO_TABLE:
1. This
parameter is applicable only when the target object on which the grant needed
is EV.
2. This
parameter decides whether permission to be granted on the underlying table also
- Values cane
passed are: TRUE(default): Grant permission on EV and its underlying
table, FALSE: Grant permission to EV only.
Below are few examples for granting SELECT on table and EXECUTE On
package:
-- Grant Select on Custom Table
BEGIN
/* First three parameters are passed and other two are Default
values*/
AD_ZD.GRANT_PRIVS ('SELECT',
'XX_CUST_TABLE',
'XXSCH');
END;
-- Grant Execute on Custom Package
BEGIN
/* First three parameters are passed and other two are Default
values*/
AD_ZD.GRANT_PRIVS ('EXECUTE',
'XX_CUST_PKG',
'XXSCH');
END;