我正在尝试通过dbplyr过滤Oracle数据库中的datetime字段。我尝试了许多不同的方法,下面是我的两个最佳猜测以及错误消息。有人知道该怎么做吗?
tbl(con2, in_schema("DB", "TABLE")) %>%
filter(FULL_DATE >= "2020-09-01 00:00:00")
给我:
Error: nanodbc/nanodbc.cpp:1617: HY000: [Oracle][ODBC][Ora]ORA-01861: literal does not match format string
<SQL> 'SELECT * FROM (SELECT *
FROM (DB.TABLE)
WHERE ("FULL_DATE" >= '2020-09-01 00:00:00')) "zzz90" WHERE ROWNUM <= 11.0'
和
tbl(con2, in_schema("DB", "TABLE")) %>%
filter(sql('CREATED_DATE >= 2020-09-01 00:00:00'))
给我:
Error in result_fetch(res@ptr, n) :
Query needs to be bound before fetching
答案 0 :(得分:1)
证明此解决方案有效:
tbl(con2, in_schema("DB", "TABLE")) %>%
filter(FULL_DATE >= to_date("2020-09-01", "YYYY:MM:DD"))