Achieving ANY() functionality in RORacle

121 Views Asked by At

I have a query I've written in SQL Developer that runs and returns what I want. I then tried to load it into R so that I can analyze the results, but I've found that my ANY() statements don't translate at all.

The query I've written is

query <- paste("SELECT * FROM DAILY_INFO t1",
   "INNER JOIN COHORTS_TABLE t2",
   "ON t1.id = t2.id",
   "WHERE t2.cohort = '2013'",
   "AND t1.level = ANY('09','10','11','12')",
   "AND t2.id2 = ANY([Placeholder for long list of numeric IDs here])",
   "ORDER BY t1.id, t1.level, t2.system_name;",
   sep=' ')

This query works exactly in SQLDeveloper but ROracle doesn't seem to recognize the ANY() statement. Is it just that the ANY() function is not accepted? I guess that it's solely a SQLDeveloper function...

Does anyone know how I can achieve that functionality simply in R?

1

There are 1 best solutions below

1
Michael Broughton On BEST ANSWER

If the ROracle driver doesn't properly recognize the ANY () Syntax, you could replace that with the IN () equivalent.

AND t1.level IN ('09','10','11','12'),
   AND t2.id2 IN ([Placeholder for long list of numeric IDs here]),

See the discussion here on ANY vs IN