我有一个查询,其中我减去两个日期,但我收到错误。这是查询
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’}
但我收到错误
ORA-00932: inconsistent datatypes: expected CHAR got DATE
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
我做错了什么?
答案 0 :(得分:1)
:endDate
绑定变量是导致错误的原因。尝试使用:endDate
函数将to_date
值显式转换为date数据类型的值。例如:
....
to_date(:endDate, 'dd.mm.yyyy') - LOSA_APP_Z.li_dt AS "Day Count",
....