'ORA-00932 convert and format dates and strings to calculate a range of days
I have a table where the date_one field is of type VARCHAR2 (20 BYTE) and the date_two field is of type DATE.
Output for date_one is 29-01-2019 20:22:08 and output for date_two is 25-JAN-19.
I need to calculate records based on an interval of days between these two fields but I'm having a hard time with this error:
select field1,field2,field3
from mytable
where
trunc(to_date(DATE_ONE, 'DD-MM-YYYY HH24:MI:SS')) - trunc(to_date(DATE_TWO 'DD-MM-YYYY')) > interval '15' day;
ORA-00932: inconsistent datatypes: expected NUMBER, got INTERVAL DAY TO SECOND 00932. 00000 - "inconsistent datatypes: expected %s got %s"
How can I fix this error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
