'Some clarification around sql verbage within R, specifically with dbListFields

I'm using R to connect to an Oracle Database. I'm able to do so with this code:

library(rJava)   
library(RJDBC)   

jdbcDriver <- JDBC(driverClass="oracle.jdbc.driver.OracleDriver", classPath="jar files/ojdbc8.jar")  
jdbcConnection <- dbConnect(jdbcDriver, "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=blablablablabla.com)(PORT=1234))(CONNECT_DATA=(SERVICE_NAME=pdblhs)))", "myusername", "mypassword")  
DataFrame <- dbGetQuery(jdbcConnection, "select protocol_id, disease_site_code, disease_site
From abc_place_prod.Rv_sip_PCL_disease_site
order by protocol_id")  

# Close connection
dbDisconnect(jdbcConnection) 

This snippet of code works. It downloads the data I want into a neat data frame and works as planned.

But I'm trying to learn how to navigate with R/SQL more and I wanted to use dbListFields to explore all the possible column names in that table I'm pulling from. Per the documentation here, you could type something like this:

dbListFields(con, "mtcars")

and it would work. So I tried:

dbListFields(jdbcConnection, "abc_place_prod.Rv_sip_PCL_disease_site")

and it returned this error:

Error in dbSendQuery(conn, paste("SELECT * FROM ", dbQuoteIdentifier(conn,  : 
  Unable to retrieve JDBC result set
  JDBC ERROR: ORA-00933: SQL command not properly ended

It seems like someone else experienced something similar here and I'm not sure it ever got answered. I've tried it with a semicolon at the end (that "ended" something else properly for me, and its mentioned in the comments of this question) and no luck.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source