R-SQL Invalid value from generic function 'fetch, class "try-error", expected "data.frame"

I am having a problem getting some data from a database using ROracle. Everything works fine (I get data from different tables without any problems), but one of the tables causes an error:

 library(ROracle)
    con <- dbConnect(dbDriver("Oracle"),"xxx/x",username="user",password="pwd")
    spalten<- dbListFields(con, name="xyz", schema = "x") # i still get the name of the columns for this table
    rs <- dbSendQuery(con, "Select * From x.xyz") # no error
    data <- fetch(rs) # this line throws an error
    dbDisconnect(con)

Fehler in .valueClassTest (ans, "data.frame", "fetch"): invalid value from the generic function 'fetch, class "try-error", expected "Data.frame"

I have completed this question: qaru.site/questions/1629525 / ... , and I have chosen the columns

rs <- dbSendQuery(con, "Select a From x.xyz")

but none of them worked and gave me the same error.

Any ideas what I'm doing wrong?

PS I checked the SQL query in Oracle SQL Developer and I get the data table there

Update:

- / Oracle, , , , .

+4
1

. tryCatch. , .

result <- tryCatch({
    con <- dbConnect(dbDriver("Oracle"),"xxx/x",username="user",password="pwd")
    spalten <- dbListFields(con, name="xyz", schema = "x")
    rs <- dbSendQuery(con, "Select * From x.xyz") # no error
    data <- fetch(rs) # this line throws an error
    dbDisconnect(con) 
}, warning = function(war) {
    print(paste("warning:  ",war))
}, error = function(err) {
    print(paste("error:  ",err))
})

print(paste("result =",result))
0

Source: https://habr.com/ru/post/1629513/


All Articles