Oracle
 sql >> Database >  >> RDS >> Oracle

SQL passa dalla decodifica al caso

Decodificare 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

Quindi

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