I'm having a problem comparing 2 dates in oracle. I am using the case method to compare the dates and at the end this should return to my table a number, which in the case represents an age, however, I get p error reporting:
PL / SQL: ORA-00932: Inconsistent data types: DATE expected to get NUMBER.
Below is the code snippet that gives the error.
(case when T1.ANO_MODELO = 0 then 0 else (case when ((W_REG.DAT_ENVIO_CALCULO) - T1.ANO_MODELO) < 0 then 0 else ((W_REG.DAT_ENVIO_CALCULO) - T1.ANO_MODELO) End) End)