0

执行以下代码时:

select distinct tam.sol_id||'|'||(select sol.sol_desc from sol where sol.sol_id=tam.sol_id)||'|'||count(*)||'|'||sum(org_tran_amt)
||'|'||count(case when ott.tran_date between '01-02-2021' and '24-02-2021' as 1 else 0 end) a
from ott,tam
where tam.acid=ott.acid
and tam.gl_sub_head_code in ('85300','85320','85330','85340','85350','85360','85365','85370','85380','85390','85395')
and tran_date <= '24-02-2021'
and tam.sol_id in (select sst.sol_id from sst where sst.set_id='ROFPZ')
and not exists (select * from tct where tct.tran_date=ott.tran_date and trim(tct.tran_id)=trim(ott.tran_id)
and nvl(ott.org_tran_amt-tct.AMT_OFFSET,0)='0' and tct.entity_cre_flg='Y' and tct.del_flg='N');

收到以下错误消息作为输出:

from ott,tam
           *
ERROR at line 3:
ORA-00905: missing keyword
4

1 回答 1

1

尝试修改语句的 case 部分:

case when ott.tran_date between '01-02-2021' and '24-02-2021' then 1 else 0 end

你必须写“then”而不是“as”。

于 2021-02-24T06:47:13.827 回答