Compare date column with varchar in Teradata
We need to retrieve the rows that service_date is greater than prod_date.
- The data type for prod_date is VARCHAR(10) (2/20/2014 for example)
- and the data type for service_date is DATE (YYYYMMDD)
So to keep things simple, it makes sense to cast
PROD_DATE to a date when comparing these two fields like :
where S.SERVICE_DATE >= cast(P.PROD_DATE as date format 'DD/MM/YYYY');