I am using dbGetQuery()
function to query the Oracle and put results into a data frame in R. I have connected to database successfully, and returned data using dbGetQuery()
with simple queries. However, I have a query looks like:
Query <- paste("With A as (SELECT * from Table A),
B as (SELECT * from Table B),
C as (SELECT * from Table C)
SELECT A.a,B.b,C.c
FROM C
LEFT OUTER JOIN A on (...)
LEFT OUTER JOIN B on (...);")
Data <- dbGetQuery(conn, Query)
I have run this query in Oracle and it works well, and returned a table with all data from Table C
and data from Table A
and B
qualified with on statement. When I paste this query to R, and use dbGetQuery()
function, I got nothing but a error warning saying:
Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", :
Unable to retrieve JDBC result set for With Albemarle_Data AS
I am wondering if anyone met similar problem before, and would be grateful if I can get any solution from you. Thank you.