This example uses the sys.rqScriptCreate
procedure to create a script in the Oracle R Enterprise R script repository.
This example creates the user-defined function named myRandomRedDots2
. The user-defined function accepts two arguments, and it returns a data.frame
object that has two columns and that plots the specified number of random normal values. The sys.rqScriptCreate
function stores the user-defined function in the Oracle R Enterprise script repository.
-- Create a script named myRandomRedDots2 and add it to the R script repository. -- Specify that the script is private and to overwrite a script with the same name. BEGIN sys.rqScriptCreate('myRandomRedDots2', 'function(divisor = 100, numDots = 100) { id <- 1:10 plot(1:numDots, rnorm(numDots), pch = 21, bg = "red", cex = 2 ) data.frame(id = id, val = id / divisor)}', v_global => FALSE, v_overwrite => TRUE); END; / -- Grant read privilege access to Scott. BEGIN rqGrant('myRandomRedDots2', 'rqscript', 'SCOTT'); END; / -- View the users granted read access to myRandomRedDots2. select * from USER_RQ_SCRIPT_PRIVS; NAME GRANTEE ---------------- ------- myRandomRedDots SCOTT -- Revoke the read privilege access from Scott. BEGIN rqRevoke('myRandomRedDots2', 'rqscript', 'SCOTT'); END; / -- Remove the script from the R script repository. BEGIN sys.rqScriptDrop('myRandomRedDots2'); END; /