The following query in SQL Developer returns 1 record:
SELECT * FROM myview WHERE to_date(acq_date_time) = to_date(CURRENT_DATE)
However, when I execute the same query in Python using cx_Oracle, I get no records:
query = "SELECT * FROM myview WHERE to_date(acq_date_time) = to_date(CURRENT_DATE)"
cursor.execute(query)
results = cursor.fetchall()
More puzzling, is that when I use this query I get 5 results (the one I expect from today plus all from the previous day):
query = "SELECT * FROM myview WHERE to_date(acq_date_time) > to_date(CURRENT_DATE - 1)"
cursor.execute(query)
results = cursor.fetchall()
I have verified the connection address in both SQL Developer and cx_Oracle are the same. I'm not getting any errors. Any ideas why this is happening? Do SQL Developer and cx_Oracle get the CURRENT_DATE
from different places?