sql >> Base de Datos >  >> RDS >> Oracle

Cambio de SQL de decodificación a caso

Decodificar significa:

CASE FirstParam
  WHEN SecondParam THEN ThirdParam 
  WHEN FourthParam THEN FifthParam
  WHEN SixthParam THEN Seventh... etcetera
  ELSE LastParam -- If number of params is odd, otherwise ELSE NULL is implied
END

Entonces

CASE APR(ACC.RATE,'X')
  WHEN 'FIRST RATE' THEN 1
  WHEN 'SECOND RATE' THEN 2
  ELSE 3
END