Date range not working in Native query

Looking in this report. You can see that when i am using a date where there is record is not appearing. But when i will select a date after date, Then it will show me that record. Will also give the query for the data below. Please assist. Thanks.


SELECT DISTINCT ROWNUM REC,LT.SYSTEMDATE DATE_REVISED,LT.TRANS_DATE TRADE_DATE, LT.TRADERID OPERATOR_NAME,
CA.ACCOUNT_OFFICER ACCOUNT_OFFICER, TD.TRANSTYPE TRANSACTION_TYPE,TYPE INVT_TYPE,
LT.SECURITYSYMBOL SECURITY_NAME,GS.RBI_SYMBOL CUSIP,PORT.PORTNAME PORTFOLIO_NAME,
LT.FIRST_LEG_QUANTITY QUANTITY_UNITS,LT.FIRST_LEG_AMOUNT TOTAL_AMOUNT,
LT.DEAL_NO TRANS_NUMBER, lt.dealer_ticket_no Dealer_Ticket_No
FROM log_transact lt, (SELECT DISTINCT operation, portcode, dealer_ticket_no, deal_no, entitycode, gross_amount, net_consideration, userid, operationdatetime FROM log_portallocation) pt, rpt_client_account ca, tbl_portmast port, transactiondef td , global_security gs , additional_transact alt
WHERE lt.deal_no = pt.deal_no
AND lt.operation =pt.operation
AND lt.systemdate = pt.operationdatetime
AND pt.portcode(+) = port.portcode
AND port.fund_code = ca.pms_acno(+)
AND lt.transaction_type_code = td.trans_code
AND lt.securitysymbol = gs.securitysymbol
AND lt.deal_no = alt.deal_no(+)
AND pt.DEAL_NO = alt.DEAL_NO (+)
AND lt.operation IN ('MODIFY')
[[and LT.SYSTEMDATE BETWEEN {{StartDate}} AND {{EndDate}}]]
order by lt.SYSTEMDATE desc

Hi @RohitRaina
Post "Diagnostic Info" from Admin > Troubleshooting.
I'm guessing that you're having problems with timezones. Try casting your column as a date.

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "Java(TM) SE Runtime Environment",
"java.runtime.version": "1.8.0_141-b15",
"java.vendor": "Oracle Corporation",
"java.vendor.url": "http://java.oracle.com/",
"java.version": "1.8.0_141",
"java.vm.name": "Java HotSpot(TM) 64-Bit Server VM",
"java.vm.version": "25.141-b15",
"os.name": "Linux",
"os.version": "3.10.0-1160.36.2.el7.x86_64",
"user.language": "en",
"user.timezone": "UTC"
},
"metabase-info": {
"databases": [
"h2",
"oracle"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"tag": "v0.38.3",
"date": "2021-04-01",
"branch": "release-x.38.x",
"hash": "8332830"
},
"settings": {
"report-timezone": "Asia/Manila"
}
}
}

How to cast column as a date?

@RohitRaina

  1. Upgrade to a newer release: https://github.com/metabase/metabase/releases/latest
  2. Upgrade to Java 11: https://www.metabase.com/docs/latest/operations-guide/java-versions.html
  3. Migrate away from H2: https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
  4. Make sure you're using ojdbc8.jar version 19.3 or newer: https://www.metabase.com/docs/latest/administration-guide/databases/oracle.html

@RohitRaina Have a look here or in the Oracle documentation: https://stackoverflow.com/questions/26062132/convert-datetime-field-to-just-a-date-field-in-sql-oracle