ORA-00905:缺少关键字

Drs*_*sin -3 sql oracle case

我的表有以下列:

|blo|NotionalCurrency|Notional|Premiumcurrency|Basecurrency|Termcurrency|StructureName|Basemarketprice|Termmarketpriceprecent |Termmarketprice|
Run Code Online (Sandbox Code Playgroud)

我想从这些获得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;
Run Code Online (Sandbox Code Playgroud)

但我得到错误: 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
Run Code Online (Sandbox Code Playgroud)

Bon*_*ist 5

你错过了end最初的案例陈述.只需在之后添加when price = 0 then price = 0.000001