Oracle
 sql >> Datenbank >  >> RDS >> Oracle

in oracle dekodieren in postgres umwandeln

Das decode Äquivalent ist CASE :

WITH p (statusgeometry) AS (VALUES (1),(2))

SELECT 
  CASE statusgeometry
    WHEN 1 THEN 'pass'
    WHEN 2 THEN 'fail'
  END,
  -- The following syntax is useful in case you need to do  "something"  
  -- with the columns depending on the condition, e.g lower(), upper(), etc..
  CASE 
    WHEN statusgeometry = 1 THEN 'pass'
    WHEN statusgeometry = 2 THEN 'fail'
  END
FROM p;

 case | case 
------+------
 pass | pass
 fail | fail
(2 rows)