datediff
isn't a function in Oracle. You also wouldn't prefix a function name with the @
sign.
Assuming that a.lastModified
and w.date_open
are both of type date
, you can simply subtract them to get a difference in days.
CASE WHEN a.CODE = 'CONTACT_CLIENT'
THEN a.lastModified - w.date_open
END
If you want an integer number of days (since date
values always include a time component, subtracting two dates will frequently result in a non-integer number of days), throw in a trunc
or a round
depending on what you want to do.
Of course, I'm not sure why you don't have an ELSE
in your CASE
statement or why you have identifiers with underscores between words (date_open
) and identifiers without underscores (lastModified
). But that doesn't appear to be part of your question.