I have a query in which I am subtracting two dates but I am getting error. Here is the query
select LOSA_APP.app_ref_no AS "App.Ref.No.",
CODE_BRANCH.branch_name AS "Business Unit",
...,
:endDate - LOSA_APP_Z.li_dt AS "Day Count",.
...
from losa_app LOSA_APP
INNER JOIN code_branch CODE_BRANCH
ON LOSA_APP.attend_branch = CODE_BRANCH.branch_id
....
where LOSA_APP.app_status='A'; -- Application Status in {‘accepted’}
But I am getting error that
ORA-00932: inconsistent datatypes: expected CHAR got DATE
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
What i am doing wrong?
The
:endDatebind variable is the cause of the error. Try to explicitly convert:endDatevalue to a value of date datatype usingto_datefunction. For example: