我的表有這些列: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