<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Date filter not working with Oracle SQL query federation in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144157#M2460</link>
    <description>&lt;P&gt;Interesting...It worked perfectly with a Cluster 18.0 Beta and&amp;nbsp;16.4 LTS, but I can only use this in notebooks, not in SQL queries and dashboards and it's very limiting for my use case.&lt;/P&gt;&lt;P&gt;I tried all the SQL Warehouses: Classic/Serverless/Pro and Preview/Current and none worked.&lt;BR /&gt;I also enabled all the preview features and tried to run the raw query, it worked, but it's a very inconvenient to ask my team to write all this code in every query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;select *
from remote_query(
  my_conn,
  service_name =&amp;gt; 'my_svc',
  query =&amp;gt;
'''
SELECT *
FROM my_schema.my_table
WHERE dt_updated &amp;gt; DATE\'2026-01-01\'
'''
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jan 2026 12:46:41 GMT</pubDate>
    <dc:creator>diogofreitaspe</dc:creator>
    <dc:date>2026-01-15T12:46:41Z</dc:date>
    <item>
      <title>Date filter not working with Oracle SQL query federation</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144046#M2454</link>
      <description>&lt;P&gt;I created an external connection to an&amp;nbsp;&lt;SPAN&gt;Oracle Database 12c Standard Edition Release 12.1.0.2.0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;select dt_updated
from external_conn.my_schema.my_table
where dt_updated &amp;gt; cast('2026-01-01' as date)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;ORA-17041: Missing IN or OUT parameter at index: 1 &lt;A class="" href="https://docs.oracle.com/error-help/db/ora-17041/" target="_blank" rel="noopener noreferrer"&gt;https://docs.oracle.com/error-help/db/ora-17041/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The "dt_updated" is a timestamp field and databricks recognizes it when I see the catalog.&lt;BR /&gt;I tried a lot of different syntaxes:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- where dt_updated &amp;gt; '2024-01-01'&lt;BR /&gt;- where dt_updated &amp;gt; DATE '2024-01-01'&lt;BR /&gt;- where dt_updated &amp;gt; TIMESTAMP('2024-01-01 00:00:00')&lt;BR /&gt;- where dt_updated &amp;gt; TO_DATE('2024-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')&lt;BR /&gt;- where dt_updated &amp;gt; TIMESTAMP '2024-01-01 00:00:00'&lt;BR /&gt;- where dt_updated &amp;gt; CAST('2024-01-01 00:00:00' AS TIMESTAMP)&lt;BR /&gt;- where dt_updated &amp;gt; TO_DATE('2024-01-01', 'YYYY-MM-DD')&lt;BR /&gt;&lt;BR /&gt;But all of them compile to the same external engine query, that I can see when I run EXPLAIN FORMATTED:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;External engine query:
SELECT "DT_UPDATED"
FROM "MY_SCHEMA"."MY_TABLE"
WHERE ("DT_UPDATED" IS NOT NULL)
AND ("DT_UPDATED" &amp;gt; 2026-01-01T00:00:00Z)  &lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Looks like the engine is not parsing correctly =/&lt;BR /&gt;I tried """&lt;/SPAN&gt;&lt;SPAN&gt;datediff&lt;/SPAN&gt;&lt;SPAN&gt;(dt_updated, &lt;/SPAN&gt;&lt;SPAN&gt;cast&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'2026-01-01'&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;date&lt;/SPAN&gt;&lt;SPAN&gt;)) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN&gt;0""" and the query run, but the performance is terrible because&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;the table is too large and this function doesn't pushdown to oracle.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Am I doing something wrong?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the oracle federated queries docs:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/query-federation/oracle" target="_blank"&gt;https://docs.databricks.com/aws/en/query-federation/oracle&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 14:31:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144046#M2454</guid>
      <dc:creator>diogofreitaspe</dc:creator>
      <dc:date>2026-01-14T14:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Date filter not working with Oracle SQL query federation</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144068#M2455</link>
      <description>&lt;P&gt;I'm checking on this internally. Will loop back.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 16:37:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144068#M2455</guid>
      <dc:creator>MoJaMa</dc:creator>
      <dc:date>2026-01-14T16:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date filter not working with Oracle SQL query federation</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144071#M2456</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/208215"&gt;@diogofreitaspe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Could you try one another option? Something like below:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;WHERE CAST(dt_updated AS DATE) &amp;gt; DATE '2026-01-01'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 16:52:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144071#M2456</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-01-14T16:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date filter not working with Oracle SQL query federation</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144092#M2458</link>
      <description>&lt;P&gt;Can you spin up a DBR 18+ all-purpose compute cluster with this spark config set to true&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;spark.databricks.connector.oracle.properlyCompileJava8Values true&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;and then re-run your tests?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 19:48:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144092#M2458</guid>
      <dc:creator>MoJaMa</dc:creator>
      <dc:date>2026-01-14T19:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date filter not working with Oracle SQL query federation</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144153#M2459</link>
      <description>&lt;P&gt;Same error, same external engine query =/&lt;BR /&gt;But you gave me an idea that is a little bit better, because the cast is pushed down to oracle:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;WHERE cast(dt_updated as string) &amp;gt; '2026-01-01'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2026 12:13:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144153#M2459</guid>
      <dc:creator>diogofreitaspe</dc:creator>
      <dc:date>2026-01-15T12:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date filter not working with Oracle SQL query federation</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144157#M2460</link>
      <description>&lt;P&gt;Interesting...It worked perfectly with a Cluster 18.0 Beta and&amp;nbsp;16.4 LTS, but I can only use this in notebooks, not in SQL queries and dashboards and it's very limiting for my use case.&lt;/P&gt;&lt;P&gt;I tried all the SQL Warehouses: Classic/Serverless/Pro and Preview/Current and none worked.&lt;BR /&gt;I also enabled all the preview features and tried to run the raw query, it worked, but it's a very inconvenient to ask my team to write all this code in every query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;select *
from remote_query(
  my_conn,
  service_name =&amp;gt; 'my_svc',
  query =&amp;gt;
'''
SELECT *
FROM my_schema.my_table
WHERE dt_updated &amp;gt; DATE\'2026-01-01\'
'''
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2026 12:46:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/144157#M2460</guid>
      <dc:creator>diogofreitaspe</dc:creator>
      <dc:date>2026-01-15T12:46:41Z</dc:date>
    </item>
    <item>
      <title>Hi @diogofreitaspe, This is a known behavior with how the...</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/150269#M2527</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/208215"&gt;@diogofreitaspe&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;This is a known behavior with how the Lakehouse Federation Oracle connector serializes date and timestamp literals during predicate pushdown. When Databricks pushes the filter down to Oracle, the date value gets rendered as a bare ISO 8601 literal (e.g. 2026-01-01T00:00:00Z) rather than being properly bound as a JDBC parameter or wrapped in Oracle-compatible date syntax. Oracle does not recognize that format, which triggers the ORA-17041 error.&lt;/P&gt;
&lt;P&gt;RECOMMENDED FIX (DBR 18+)&lt;/P&gt;
&lt;P&gt;If you are on Databricks Runtime 18.0 or later, set this Spark configuration on your cluster or SQL warehouse:&lt;/P&gt;
&lt;PRE&gt;spark.databricks.connector.oracle.properlyCompileJava8Values true&lt;/PRE&gt;
&lt;P&gt;This config corrects how Java 8 date/time values are compiled into the pushed-down query, so Oracle receives a properly formatted and bound date parameter. After setting this, re-run your original query:&lt;/P&gt;
&lt;PRE&gt;SELECT dt_updated
FROM external_conn.my_schema.my_table
WHERE dt_updated &amp;gt; CAST('2026-01-01' AS DATE)&lt;/PRE&gt;
&lt;P&gt;If you are running on a SQL warehouse (serverless), you may not be able to set arbitrary Spark configs. In that case, try the workarounds below while the fix propagates to the serverless runtime.&lt;/P&gt;
&lt;P&gt;WORKAROUNDS FOR SERVERLESS OR OLDER RUNTIMES&lt;/P&gt;
&lt;P&gt;1. Use the ANSI DATE literal syntax:&lt;/P&gt;
&lt;PRE&gt;SELECT dt_updated
FROM external_conn.my_schema.my_table
WHERE CAST(dt_updated AS DATE) &amp;gt; DATE '2026-01-01'&lt;/PRE&gt;
&lt;P&gt;The DATE 'YYYY-MM-DD' literal is part of the ANSI SQL standard and may be pushed down differently than CAST expressions.&lt;/P&gt;
&lt;P&gt;2. Use a pass-through string comparison (if the column permits it):&lt;/P&gt;
&lt;PRE&gt;SELECT dt_updated
FROM external_conn.my_schema.my_table
WHERE dt_updated &amp;gt; '2026-01-01'&lt;/PRE&gt;
&lt;P&gt;This sometimes avoids the date-specific pushdown path entirely, though behavior depends on Oracle's implicit type conversion settings.&lt;/P&gt;
&lt;P&gt;3. Disable filter pushdown temporarily to confirm the root cause:&lt;/P&gt;
&lt;PRE&gt;SET spark.databricks.connector.oracle.pushDownFilter = false;

SELECT dt_updated
FROM external_conn.my_schema.my_table
WHERE dt_updated &amp;gt; CAST('2026-01-01' AS DATE)&lt;/PRE&gt;
&lt;P&gt;With pushdown disabled, Databricks will pull all rows and apply the filter locally. This is not ideal for large tables, but it confirms whether the issue is specifically in the pushdown layer.&lt;/P&gt;
&lt;P&gt;ADDITIONAL NOTES&lt;/P&gt;
&lt;P&gt;- Oracle DATE columns are mapped to TimestampType (or TimestampNTZType depending on your spark.sql.timestampType setting) in Databricks. This means your filter comparisons should use timestamp-compatible syntax.&lt;BR /&gt;
- The supported pushdown operations for Oracle federation include filters, projections, limit, aggregates, offset, cast, and string operations. Date filter pushdown is supported, but the literal serialization issue you are hitting is the specific problem addressed by the Spark config above.&lt;BR /&gt;
- If you are on Oracle 11.2.0.3.0 or later and see ORA-01882 timezone errors as well, check the spark.databricks.connector.oracle.timezoneAsRegion config documented here: &lt;A href="https://docs.databricks.com/en/query-federation/oracle.html" target="_blank"&gt;https://docs.databricks.com/en/query-federation/oracle.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;REFERENCES&lt;/P&gt;
&lt;P&gt;- Lakehouse Federation for Oracle: &lt;A href="https://docs.databricks.com/en/query-federation/oracle.html" target="_blank"&gt;https://docs.databricks.com/en/query-federation/oracle.html&lt;/A&gt;&lt;BR /&gt;
- Lakehouse Federation overview: &lt;A href="https://docs.databricks.com/en/query-federation/index.html" target="_blank"&gt;https://docs.databricks.com/en/query-federation/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;
&lt;P&gt;If this answer resolves your question, could you mark it as "Accept as Solution"? That helps other users quickly find the correct fix.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2026 00:54:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/date-filter-not-working-with-oracle-sql-query-federation/m-p/150269#M2527</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-03-09T00:54:24Z</dc:date>
    </item>
  </channel>
</rss>

