From: Doris Bernloehr <bedo7@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Regarding decode function
Date: Sat, 04 Oct 2003 02:50:14 +0200
Message-ID: <3F7E1946.3060604@gmx.net> (raw)
In-Reply-To: <OF26467F7D.FE351814-ON88256DB2.007CB280-88256DB2.007C4B24@intra.cymer.com>
References: <OF26467F7D.FE351814-ON88256DB2.007CB280-88256DB2.007C4B24@intra.cymer.com>
> Right now I have a query which uses decode function to get data in
> Oracle database, I want know is there any alternative function to
> decode which can do the decode functionality in Postgresql.
Oracle: decode (value, 0, 'zero', 1, 'one', 'unknown')
In PostgreSQL you have to use CASE WHEN Syntax:
ANSI: CASE WHEN value=0 THEN 'zero' WHEN value=1 THEN 'one' ELSE
'unknown' END
or
CASE value WHEN 0 THEN 'zero' WHEN 1 THEN 'one' ELSE 'unknown' END
Regards
Doris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bedo7@gmx.net
Subject: Re: Regarding decode function
In-Reply-To: <3F7E1946.3060604@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox