Oracle
 sql >> Base de données >  >> RDS >> Oracle

décoder dans oracle convertir en postgres

Le decode l'équivalent est 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)