Skip to content

Possible incorrect date literal translation for Oracle? #661

@mfherman

Description

@mfherman

I'm trying a simple filter on a date column in an Oracle 19c database and getting the following error:

Error: nanodbc/nanodbc.cpp:1655: HY000: [Oracle][ODBC][Ora]ORA-00936: missing expression

It appears that the issue (in my Oracle instance) is caused by the parenthesis surrounding the date in the dbplyr translation

tbl(con, "TEST_TABLE") %>%    
  filter(DT == as.Date("2020-01-01")) %>% 
  show_query()
# <SQL>
# SELECT *
# FROM ("TEST_TABLE") 
# WHERE ("DT" = DATE('2020-01-01'))

If I run the same query with the parentheses removed in my SQL IDE, the query runs with no error.

SELECT *
FROM ("TEST_TABLE") 
WHERE ("DT" = DATE '2020-01-01')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions