遇到错误
ORA-00932: inconsistent datatypes: expected CHAR got NUMBER 00932. 00000 - "inconsistent datatypes: expected %s got %s"
当我运行以下查询
SELECT distinct CASE when t.cancelled = 'TRUE' then '0' else t.amount END AMOUNT, FROM table t
如果我使用其他输出的数字或文本运行它,像这样,它就可以工作。
SELECT distinct CASE when t.cancelled = 'TRUE' then '0' else 'xxx' END AMOUNT, FROM table t
使用0代替'0'。金额是数字,数字不加引号。
0
'0'
SELECT distinct CASE when t.cancelled = 'TRUE' then 0 else t.amount END AMOUNT, FROM table t