- or download this
nvl <-> coalesce
decode <-> case x when bool then y when bool then z else zz end
cube <-> contrib/crosstab (to some extent..)
- or download this
playtest=# select * from xl_odbc_test;
col_1 | col_2
...
200 | two hundred
300 | three hundred
(9 rows)
- or download this
select pl.decode(col_1,$$<75,,$$||col_2||$$<-value,,<250,,$$||col_1||$
+$,,default value$$) from xl_odbc_test;
- or download this
select case when col_1 < 75 then col_2 || '<-value'
when col_1 < 250 then cast(col_1 as text)
else 'default value'
end
from xl_odbc_test;
- or download this
decode
---------------
...
200
default value
(9 rows)
- or download this
CREATE OR REPLACE FUNCTION pl.decode(selector text, clauses text)
RETURNS text AS
...
$BODY$
LANGUAGE 'plperlu' IMMUTABLE SECURITY DEFINER;
GRANT EXECUTE ON FUNCTION pl.decode(selector text, clauses text) TO pu
+blic;