Currently I am trying to compare date fields with the below statement
AND (AIA.INVOICE_DATE >= NVL(TO_DATE(:P_INV_DT_FROM,'DD-MON-YYYY'), '01-JAN-1900')
OR AIA.INVOICE_DATE IS NULL)
AND (AIA.INVOICE_DATE <= NVL(TO_DATE(:P_INV_DT_TO,'DD-MON-YYYY'), '31-DEC-4712')
OR AIA.INVOICE_DATE IS NULL)
However, I am getting the below error,
ORA-01861: literal does not match format string 01861. 00000 - "literal does not match format string"
*Cause: Literals in the input must be the same length as literals in the format string (with the exception of leading whitespace). If the "FX" modifier has been toggled on, the literal must match exactly, with no extra whitespace.
*Action: Correct the format string to match the literal.
P.S: AIA.INVOICE_DATE is tn the form of 'DD-MON-YYYY' and p_inv_dt_from and p_inv_dt_to is in the form of 'YYYY/MM/DD HH24:MM:SS'
'01-JAN-1900','31-DEC-4712'- Jeffrey KempAIA.INVOICE_DATEhas any "format", it must be a string, not a date column. - Jeffrey Kemp