1 Reply Latest reply: Apr 24, 2012 8:46 AM by Denis Mukhin-Oracle RSS

    having trouble with ore.tableApply() demo script

      I have verified that RQSCRIPTCREATE exists in SYS schema, and my demo user has RQROLE assigned, and I tried assigning RQADMIN as well (redundant). Any ideas?

      ORE> # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y
      ORE> #
      ORE> # Name: table_apply.R
      ORE> # Description: Execute R code on all rows of a table
      ORE> # passed in at once
      ORE> #
      ORE> #
      ORE> ## Set page width
      ORE> options(width = 80)

      ORE> # List all accessible tables and views in the Oracle database
      ORE> ore.ls()
      [1] "IRIS_TABLE"

      ORE> # Create a new table called IRIS_TABLE in the Oracle database
      ORE> # using the built-in iris data.frame
      ORE> # First remove previously created IRIS_TABLE objects from the
      ORE> # global environment and the database
      ORE> if (exists("IRIS_TABLE", globalenv(), inherits = FALSE))
      + rm("IRIS_TABLE", envir = globalenv())

      ORE> ore.drop(table = "IRIS_TABLE")

      ORE> # Create the table
      ORE> ore.create(iris, table = "IRIS_TABLE")

      ORE> # Show the updated list of accessible table and views
      ORE> ore.ls()
      [1] "IRIS_TABLE"

      ORE> # Display the class of IRIS_TABLE and where it can be found in
      ORE> # the search path
      ORE> class(IRIS_TABLE)
      [1] "ore.frame"
      [1] "OREbase"

      ORE> search()
      [1] ".GlobalEnv" "package:datasets" "ore:RQUSER"
      [4] "package:ORE" "package:ORExml" "package:OREeda"
      [7] "package:OREgraphics" "package:OREstats" "package:MASS"
      [10] "package:graphics" "package:grDevices" "package:stats"
      [13] "package:OREbase" "package:ROracle" "package:DBI"
      [16] "package:utils" "package:methods" "Autoloads"
      [19] "package:base"

      ORE> find("IRIS_TABLE")
      [1] "ore:RQUSER"

      ORE> # Build a regression model using in memory data
      ORE> mod = lm(Sepal.Length ~ . - Species, data = iris)

      ORE> # Use tableApply to predict using the model on all rows of IRIS_TABLE
      ORE> ore.tableApply(IRIS_TABLE,
      + function(dat, mod)
      + {
      + cbind(dat, PRED = predict(mod, newdata = dat))
      + },
      + mod = mod)
      Error in .oci.GetQuery(conn, statement, ...) :
      ORA-06550: line 1, column 7:
      PLS-00201: identifier 'SYS.RQSCRIPTCREATE' must be declared
      ORA-06550: line 1, column 7:
      PL/SQL: Statement ignored
        • 1. Re: having trouble with ore.tableApply() demo script
          Denis Mukhin-Oracle
          To run ore.*Apply or ore.doEval functions using FUN parameter the user you are connecting to in ore.connect needs to have an RQADMIN role. Once the role is granted you need to reconnect your R session. If you are only using FUN.NAME parameter to run existing scripts RQROLE role is sufficient.

          Please, verify that your user has both RQROLE and RQADMIN roles and try to restart your R sessions and reconnect to ORE. Let me know if that worked for you. If not, could you, please, tell me what version of ORE you are running (1.0 or 1.1), how did you create the DB user you are connecting to in ORE and whether this is a fresh install or an upgrade from 1.0. Did you have Beta version installed on the same system?