Shortly, I am using JDBC
and I am trying to write a query that will return some values from an SQL developer db table.
So far i have this:
#Query for getting data
sql <- paste("select *
FROM GRID Z
where Z.LAT = Xlat AND Z.LON = Xlon")
fun <- dbGetQuery(jdbcConnection, sql)
attach(fun)
Problem is that Xlat
and Xlon
are variables in R and their values change frequently so I can't really hard-pass them into the query. Apparently, Z.LAT
and Z.LON
correspond to GRID
table.
Question is: Is it possible to use R variables into a query as such?
I would also like to know if instead of =
is there something to match the closest or nearest values.
Appreciate any suggestions. Thanks
Edit: Another approach to this would be to SELECT *
from my table, and then 'play' with fun
in order to get my values. Any thoughts or practices on that?
Note: jdbcConnection
is asking for a remote connection.