This topic lists the PL/SQL procedures and Oracle Database data dictionary views for creating and managing R scripts.
The functions in the SQL API for embedded R execution require as an argument a named script that is stored in the Oracle R Enterprise R script repository. The PL/SQL procedures sys.rqScriptCreate
and sys.rqScriptDrop
create and drop scripts. To create a script or drop one from the Oracle R Enterprise R script repository requires the RQADMIN role.
When using the sys.rqScriptCreate
function, you must specify a name for the script and an R function script that contains a single R function definition. Calls to the functions sys.rqScriptCreate
and sys.rqScriptDrop
must be wrapped in a BEGIN-END
PL/SQL block. The R script repository stores the R function as a character large object (a CLOB
), so you must enclose the function definition in single quotes to specify it as a string.
The owner of a script can use the rqGrant
procedure to grant to another user read privilege access to a script or use the rqRevoke
procedure to revoke the privilege. To use a script granted to you by another user, you must specify the owner by prepending the owner’s name and a period to the name of the script, as in the following:
select * from table(rqEval(NULL, ‘select 1 x from dual’, ‘owner_name.script_name’));
The owner prefix is not required for a public script or for a script owned by the user.
The following tables list the PL/SQL procedures for managing Oracle R Enterprise R script repository scripts and the data dictionary views that contain information about scripts.
Table 6-3 PL/SQL Procedures for Managing Scripts
PL/SQL Procedure | Description |
---|---|
rqGrant |
Grants read privilege access to a datastore or script. |
rqRevoke |
Revokes read privilege access to a datastore or script. |
sys.rqScriptCreate |
Adds the provided R function into the Oracle R Enterprise R script repository with the provided name. |
sys.rqScriptDrop |
Removes the named R function from the Oracle R Enterprise R script repository. |
Table 6-4 Data Dictionary Views for Scripts
Data Dictionary View | Description |
---|---|
ALL_RQ_SCRIPTS |
Describes the scripts in the Oracle R Enterprise R script repository that are available to the current user |
USER_RQ_SCRIPTS |
Describes the scripts in the Oracle R Enterprise R script repository that are owned by the current user. |
USER_RQ_SCRIPT_PRIVS |
Describes the scripts in the Oracle R Enterprise R script repository to which the current user has granted read access and the users to whom access has been granted. |
SYS.RQ_SCRIPTS |
Describes the system scripts in the Oracle R Enterprise R script repository. |