cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Date filter not working with Oracle SQL query federation

diogofreitaspe
Visitor

I created an external connection to an Oracle Database 12c Standard Edition Release 12.1.0.2.0.

The connection is working, I executed successfully a lot of queries with different filters and joins. But I couldn't find a way to make any date filter pushdown work. When I try to run a simple query with a date filter I get this error:

select dt_updated
from external_conn.my_schema.my_table
where dt_updated > cast('2026-01-01' as date)

ORA-17041: Missing IN or OUT parameter at index: 1 https://docs.oracle.com/error-help/db/ora-17041/

The "dt_updated" is a timestamp field and databricks recognizes it when I see the catalog.
I tried a lot of different syntaxes:

- where dt_updated > '2024-01-01'
- where dt_updated > DATE '2024-01-01'
- where dt_updated > TIMESTAMP('2024-01-01 00:00:00')
- where dt_updated > TO_DATE('2024-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
- where dt_updated > TIMESTAMP '2024-01-01 00:00:00'
- where dt_updated > CAST('2024-01-01 00:00:00' AS TIMESTAMP)
- where dt_updated > TO_DATE('2024-01-01', 'YYYY-MM-DD')

But all of them compile to the same external engine query, that I can see when I run EXPLAIN FORMATTED:

External engine query:
SELECT "DT_UPDATED"
FROM "MY_SCHEMA"."MY_TABLE"
WHERE ("DT_UPDATED" IS NOT NULL)
AND ("DT_UPDATED" > 2026-01-01T00:00:00Z)  

Looks like the engine is not parsing correctly =/
I tried """
datediff(dt_updated, cast('2026-01-01' as date)) > 0""" and the query run, but the performance is terrible because the table is too large and this function doesn't pushdown to oracle. 

Am I doing something wrong?

Here is the oracle federated queries docs:
https://docs.databricks.com/aws/en/query-federation/oracle 

3 REPLIES 3

MoJaMa
Databricks Employee
Databricks Employee

I'm checking on this internally. Will loop back.

szymon_dybczak
Esteemed Contributor III

Hi @diogofreitaspe ,

Could you try one another option? Something like below:

WHERE CAST(dt_updated AS DATE) > DATE '2026-01-01'

 

MoJaMa
Databricks Employee
Databricks Employee

Can you spin up a DBR 18+ all-purpose compute cluster with this spark config set to true

spark.databricks.connector.oracle.properlyCompileJava8Values true

and then re-run your tests?

If this works then I think it might be a known issue and we can find a path forward for dbsql/serverless compute (where you won't be able to set this config yourself).