在第3行的时候继续得到错误丢失关键字我知道我在案例陈述中做错了什么但是无法弄清楚是什么
this is where cubic32.csv ends
答案 0 :(得分:2)
将整个case when...
更改为coalesce()
:
coalesce(V.MIN_CUST_PRICE, V.MIN_CUST_NAT_PRICE, V.MIN_SELL_PRICE, 0)
答案 1 :(得分:0)
根据Oracle nested CASE statements它应该是这样的:
select DISTINCT p.code, a.itemno, a.descrip, a.rev, a.class, a.std_cost, a.std_price, t.trans_in_out, t.trans_quan,
(select case when V.MIN_CUST_PRICE is null then
(case when V.MIN_CUST_NAT_PRICE is null then
(case when V.MIN_SELL_PRICE is null then 0
else V.MIN_SELL_PRICE end)
else V.MIN_CUST_NAT_PRICE end)
else V.MIN_CUST_PRICE
end
from v_sca_item_price_summary v where rownum = '1') as Value
from arinvt a, translog t, eplant e, v_sca_item_price_summary v, prod_code p
where v.arinvt_id = a.id
and a.prod_code_id = p.id
and t.eplant_id = e.id
and t.trans_date between :start_date and :end_date
我希望对你有所帮助:)。
答案 2 :(得分:0)
您的CASE
语法错误...实际语法是
CASE WHEN <condition> THEN VALUE
WHEN <condition> THEN VALUE
...
ELSE default_value END
将其与您的相比较,您会发现错误THEN
值,并且您有多个ELSE
语句
case when V.MIN_CUST_PRICE is null then ???
when V.MIN_CUST_NAT_PRICE is null then ???
when V.MIN_SELL_PRICE is null then 0
else V.MIN_SELL_PRICE ???
else V.MIN_CUST_NAT_PRICE ???
else V.MIN_CUST_PRICE ???
end