Skip to content
Prev 22324 / 398502 Next

variables inside an Rdi-select statement?!

Dear R-users,

I would like to use an environment variable inside an SELECT-statement
from R to a postgres-db, but it will not work and so I need some advice
from you.
<code>
ezg <- Sys.getenv("EZG")
connect <- dbConnect.PgSQL(host="localhost", user="username",
dbname="dbname")
query <-  dbSendQuery(connect, "SELECT ezg.s FROM ezg  WHERE
ezg.s!='12'")
</code>
the error is, that SELECT searches for the relation ezg, but it should
use value stored in ezg.

Any suggestions?

thanks in advance

stephan