我的表有这些列:ORA-00905:缺少关键字
|blo|NotionalCurrency|Notional|Premiumcurrency|Basecurrency|Termcurrency|StructureName|Basemarketprice|Termmarketpriceprecent |Termmarketprice|
我想从这些获得BLO,货币和价格。下面是我的SQL:
select blo.opt,
case
when opt.premiumcurrency is not null and opt.structurename is not null then currency = opt.premiumcurrency
case
when opt.notionalcurrency = opt.basecurrency and opt.premiumcurrency = opt.termcurrency then price = opt.termmarketpricepercent/opt.notional
else
case
when opt.premiumcurrency = opt.basecurrency then price = opt.basemarketprice /100
else
price = opt.termmarketpriceprecent /100
end
end
when price = 0 then price = 0.000001
end
FROM interface opt
WHERE opt.notionalcurrency = opt.basecurrency and opt.premiumcurrency = opt.termcurrency;
,但我得到的错误:ORA-00905: missing keyword
基本上,下面的逻辑应该被用来获取/导出SQL让三列:BLO,货币及价格:
If notional currency = base currency and premium currency=term currency Then
Price =term market price/notional
currency = notional currency
Else
If notional currency = premium currency then
Price= base market price /100
currency = termcurrency
else
Price=term market price percent /100
currency = notional
end if
end if
if price=0 then
price=0.000001
end if
'blo.opt'后面有一个逗号丢失 – Sathya 2015-02-09 10:07:49
第二种情况是在第一种情况下,没有其他/情况条件。另外,我认为你没有理由有太多的嵌套情况,请[编辑]并发布你的要求是什么 – Sathya 2015-02-09 10:17:41
编辑你的问题的方式,使现有的答案无效似乎有点粗鲁。现在有人提到这个问题,现在会认为Bonesist的答案是无关或错误的,除非他们检查编辑历史。 – 2015-02-09 11:13:01