ORA-01878: specified field not found in datetime or interval

hy guys,

I receive that error when i try to filter by date …

Have any idea?

{
“browser-info”: {
“language”: “en-US”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“java.runtime.name”: “Java™ SE Runtime Environment”,
“java.runtime.version”: “1.8.0_231-b11”,
“java.vendor”: “Oracle Corporation”,
“java.vendor.url”: “http://java.oracle.com/”,
“java.version”: “1.8.0_231”,
“java.vm.name”: “Java HotSpot™ 64-Bit Server VM”,
“java.vm.version”: “25.231-b11”,
“os.name”: “Windows 10”,
“os.version”: “10.0”,
“user.language”: “en”,
“user.timezone”: “America/Sao_Paulo”
},
“metabase-info”: {
“databases”: [
“h2”,
“oracle”
],
“hosting-env”: “unknown”,
“application-database”: “mysql”,
“run-mode”: “prod”,
“version”: {
“tag”: “v0.34.0”,
“date”: “2019-12-19”,
“branch”: “release-0.34.x”,
“hash”: “1335215”
},
“settings”: {
“report-timezone”: “America/Sao_Paulo”
}
}
}

Hi @wsca
Which version of Oracle DB?
Which version of ojdbc8.jar are you using?
Looks like the error has something to do with Daylight Saving Time:
https://stackoverflow.com/questions/22305466/oracle-date-compare-broken-because-of-dst

look …

@wsca So you’re using ojdbc8.jar version 19.3 (SHA1: 967c0b1a2d5b1435324de34a9b8018d294f8f47b) ?
Did you use previous versions of Metabase (which version?), where it used to work?
And did you check the stackoverflow question I linked to?

@wsca It would also be helpful if you include the query you’re using and any server logs that show up on the Metabase side when you run the query. I haven’t been able to reproduce this in my environment with a similar date field.

Hello, I have the same problem.
I tried with ojdbc8 and ojdbc10.
Here is te server log.

SQLDataException:
Message: ORA-01878: o campo especificado não foi encontrado em datetime ou no intervalo

SQLState: 22008
Error Code: 1878
01-28 10:41:27 ERROR sql-jdbc.execute :: nil
01-28 10:41:28 WARN middleware.process-userland-query :: Falha na consulta {:status :failed,
:class java.sql.SQLDataException,
:error “ORA-01878: o campo especificado não foi encontrado em datetime ou no intervalo\n”,
:stacktrace
(“oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)”
“oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)”
“oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)”
“oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)”
“oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)”
“oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)”
“oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)”
“oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)”
“oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:747)”
“oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:904)”
“oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1082)”
“oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)”
“oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)”
“oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3822)”
“oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1165)”
“com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:431)”
“clojure.java.jdbc$execute_query_with_params.invokeStatic(jdbc.clj:1072)”
“clojure.java.jdbc$execute_query_with_params.invoke(jdbc.clj:1066)”
“clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1081)”
“clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1075)”
“clojure.java.jdbc$query.invokeStatic(jdbc.clj:1164)”
“clojure.java.jdbc$query.invoke(jdbc.clj:1126)”
“–> driver.sql_jdbc.execute$cancelable_run_query$fn__69313.invoke(execute.clj:225)”
“driver.sql_jdbc.execute$do_with_ensured_connection.invokeStatic(execute.clj:202)”
“driver.sql_jdbc.execute$do_with_ensured_connection.invoke(execute.clj:200)”
“driver.sql_jdbc.execute$cancelable_run_query.invokeStatic(execute.clj:217)”
“driver.sql_jdbc.execute$cancelable_run_query.invoke(execute.clj:213)”
“driver.sql_jdbc.execute$run_query.invokeStatic(execute.clj:239)”
“driver.sql_jdbc.execute$run_query.invoke(execute.clj:235)”
“driver.sql_jdbc.execute$run_query_with_timezone$fn__69340.invoke(execute.clj:331)”
“driver.sql_jdbc.execute$do_with_auto_commit_disabled.invokeStatic(execute.clj:286)”
“driver.sql_jdbc.execute$do_with_auto_commit_disabled.invoke(execute.clj:274)”
“driver.sql_jdbc.execute$do_in_transaction$fn__69334.invoke(execute.clj:291)”
“driver.sql_jdbc.execute$do_in_transaction.invokeStatic(execute.clj:290)”
“driver.sql_jdbc.execute$do_in_transaction.invoke(execute.clj:289)”
“driver.sql_jdbc.execute$run_query_with_timezone.invokeStatic(execute.clj:317)”
“driver.sql_jdbc.execute$run_query_with_timezone.invoke(execute.clj:316)”
“driver.sql_jdbc.execute$execute_query$fn__69357.invoke(execute.clj:352)”
“driver.sql_jdbc.execute$do_with_try_catch.invokeStatic(execute.clj:266)”
“driver.sql_jdbc.execute$do_with_try_catch.invoke(execute.clj:260)”
“driver.sql_jdbc.execute$execute_query.invokeStatic(execute.clj:346)”
“driver.sql_jdbc.execute$execute_query.invoke(execute.clj:339)”
“driver.sql_jdbc$fn__71223.invokeStatic(sql_jdbc.clj:44)”
“driver.sql_jdbc$fn__71223.invoke(sql_jdbc.clj:43)”
“driver.oracle$eval335$fn__336.invoke(oracle.clj:237)”
“query_processor$fn__46284$execute_query__46289$fn__46290.invoke(query_processor.clj:69)”
“query_processor$fn__46284$execute_query__46289.invoke(query_processor.clj:64)”
“query_processor.middleware.mbql_to_native$mbql__GT_native$fn__37473.invoke(mbql_to_native.clj:40)”
“query_processor.middleware.annotate$result_rows_maps__GT_vectors$fn__40580.invoke(annotate.clj:541)”
“query_processor.middleware.annotate$add_column_info$fn__40486.invoke(annotate.clj:485)”
“query_processor.middleware.cumulative_aggregations$handle_cumulative_aggregations$fn__41521.invoke(cumulative_aggregations.clj:57)”
“query_processor.middleware.resolve_joins$resolve_joins$fn__43379.invoke(resolve_joins.clj:184)”
“query_processor.middleware.limit$limit$fn__42156.invoke(limit.clj:19)”
“query_processor.middleware.results_metadata$record_and_return_metadata_BANG_$fn__46144.invoke(results_metadata.clj:87)”
“query_processor.middleware.format_rows$format_rows$fn__42144.invoke(format_rows.clj:76)”
“query_processor.middleware.add_dimension_projections$add_remapping$fn__38233.invoke(add_dimension_projections.clj:234)”
“query_processor.middleware.add_source_metadata$add_source_metadata_for_source_queries$fn__38884.invoke(add_source_metadata.clj:107)”
“query_processor.middleware.resolve_source_table$resolve_source_tables$fn__43429.invoke(resolve_source_table.clj:46)”
“query_processor.middleware.add_row_count_and_status$add_row_count_and_status$fn__38721.invoke(add_row_count_and_status.clj:16)”
“query_processor.middleware.driver_specific$process_query_in_context$fn__41596.invoke(driver_specific.clj:12)”
“query_processor.middleware.resolve_driver$resolve_driver$fn__43043.invoke(resolve_driver.clj:22)”
“query_processor.middleware.store$initialize_store$fn__46169$fn__46170.invoke(store.clj:11)”
“query_processor.store$do_with_store.invokeStatic(store.clj:46)”
“query_processor.store$do_with_store.invoke(store.clj:40)”
“query_processor.middleware.store$initialize_store$fn__46169.invoke(store.clj:10)”
“query_processor.middleware.async$async__GT_sync$fn__37384.invoke(async.clj:23)”
“query_processor.middleware.async_wait$runnable$fn__40637.invoke(async_wait.clj:89)”),
:query
{:query
{:source-table 34158,
:filter [“and” [“is-null” [“field-id” 435906]] ["=" [“field-id” 435903] “Completed”] ["=" [“datetime-field” [“field-id” 435923] “month”] “2018-06-01T00:00:00-03:00”]],
:aggregation [[“sum” [“field-id” 435904]] [“sum” [“field-id” 435907]]],
:breakout [[“datetime-field” [“field-id” 435923] “week”]]},
:type “query”,
:parameters [],
:async? true,
:middleware {:add-default-userland-constraints? true, :userland-query? true},
:info
{:executed-by 2,
:context :ad-hoc,
:card-id nil,
:nested? false,
:query-hash [-66, -31, 70, -46, 113, -70, -47, 18, -9, 24, 46, 127, -33, 117, 28, 109, 27, -47, 58, 124, 20, 116, 47, -108, 41, -56, -31, 30, -27, 9, -21, -33]},
:constraints {:max-results 10000, :max-results-bare-rows 2000}},
:preprocessed
{:constraints {:max-results 10000, :max-results-bare-rows 2000},
:type :query,
:middleware {:add-default-userland-constraints? true, :userland-query? true},
:info
{:executed-by 2,
:context :ad-hoc,
:nested? false,
:query-hash [-66, -31, 70, -46, 113, -70, -47, 18, -9, 24, 46, 127, -33, 117, 28, 109, 27, -47, 58, 124, 20, 116, 47, -108, 41, -56, -31, 30, -27, 9, -21, -33]},
:preprocessing-level 1,
:database 4,
:query
{:source-table 34158,
:filter
[:and
[:= [:field-id 435906] [:value nil {:base_type :type/Decimal, :special_type nil, :database_type “NUMBER”}]]
[:= [:field-id 435903] [:value “Completed” {:base_type :type/Text, :special_type :type/Category, :database_type “VARCHAR2”}]]
[:and
[:>= [:datetime-field [:field-id 435923] :default] [:absolute-datetime (t/offset-date-time “2018-06-01T00:00-03:00”) :default]]
[:< [:datetime-field [:field-id 435923] :default] [:absolute-datetime (t/offset-date-time “2018-07-01T00:00-03:00”) :default]]]],
:aggregation [[:aggregation-options [:sum [:field-id 435904]] {:name “sum”}] [:aggregation-options [:sum [:field-id 435907]] {:name “sum_2”}]],
:breakout [[:datetime-field [:field-id 435923] :week]],
:order-by [[:asc [:datetime-field [:field-id 435923] :week]]]}},
:native
{:query
“SELECT trunc(“METABASE”.“BEETOOLS”.“DATA_CRIACAO”, ‘day’) AS “DATA_CRIACAO”, sum(“METABASE”.“BEETOOLS”.“VALOR_BEETOOLS”) AS “sum”, sum(“METABASE”.“BEETOOLS”.“TOTAL_DA_VENDA”) AS “sum_2” FROM “METABASE”.“BEETOOLS” WHERE (“METABASE”.“BEETOOLS”.“NOTA_FISCAL” IS NULL AND “METABASE”.“BEETOOLS”.“STATUS” = ? AND (“METABASE”.“BEETOOLS”.“DATA_CRIACAO” >= ? AND “METABASE”.“BEETOOLS”.“DATA_CRIACAO” < ?)) GROUP BY trunc(“METABASE”.“BEETOOLS”.“DATA_CRIACAO”, ‘day’) ORDER BY trunc(“METABASE”.“BEETOOLS”.“DATA_CRIACAO”, ‘day’) ASC”,
:params (“Completed” (t/offset-date-time “2018-06-01T00:00-03:00”) (t/offset-date-time “2018-07-01T00:00-03:00”))},
:cause {:class oracle.jdbc.OracleDatabaseException, :error “ORA-01878: o campo especificado não foi encontrado em datetime ou no intervalo\n”}}

1 Like

Hi,

Has anyone managed to resolve this issue? I have the same problem.

Metabase: v0.38.2
Oracle: 18

Even when the field is of type date, metabase is treating the field as datetime.

And I have a date field with no time or timezone information. But when I make filters through the metabase the date parameter is passed like this:

:params (#t “2012-01-07T00:00-02:00”)

For reference - there’s an issue open. Please include a way to reproduce the problem:
https://github.com/metabase/metabase/issues/11866

@flamber I changed report timezone to GMT-03 and worked… it looks like America/Sao_Paulo is the problem. For some reason the id returns -02 instead of -03. For now Brazil has no daylight saving time. So it seems solved, but I think it could be better investigated.