Search code examples
roracledbi

R odbc on oracle 11.2 ORA-00933


I am using the R DBI package to query a oracle database. When using inner joins it gives me the following error. Plain SELECTS without INNER JOIN works fine. Why?

Error: nanodbc/nanodbc.cpp:1617: 00000: [Oracle][ODBC][Ora]ORA-00933: SQL command not properly ended

DBI::dbGetQuery(con_ora, "SELECT dat.LP_ZP_ID, dat.LP_TIMESTAMP_LOC, dat.LP_WERT, zp.ZP_ZAEHLPUNKT
                          FROM EDM_LP_DATEN dat 
                          INNER_JOIN EDM_ZAEHLPUNKT zp ON zp.ZP_ID=dat.LP_ZP_ID    
                          WHERE dat.ZP_ID = 111 AND dat.LP_TIMESTAMP_LOC >= TIMESTAMP '2021-01-01 00:00:00'")

Solution

  • What's obviously wrong is this:

    INNER_JOIN EDM_ZAEHLPUNKT 
    

    It is not inner_join but inner join (without underscore).

    The rest of your query looks OK.