Comparing Date With Sysdate In Oracle
I have a column which is of 'DATE' type and I want to run a query on it comparing it with sysdate. But I am getting following error, Can someone please let me know what I am missin
Solution 1:
You shouldn't use to_date on a date, To_date is for casting a varchar to date, not a date. If you do use the function to_date on a date, then oracle will refer to it as a string according to nls_date_format which may vary in different environments. As @jonearles said, if you want to remove the time in sysdate then use TRUNC
Solution 2:
USE:
selectdistinct file_name as r
from table_1
where view_day >= TRUNC(SYSDATE-10)
Post a Comment for "Comparing Date With Sysdate In Oracle"