Re: Oracle decode Function in Postgres - Mailing list pgsql-general

From Jeff Eckermann
Subject Re: Oracle decode Function in Postgres
Date
Msg-id 20030903144112.82978.qmail@web20809.mail.yahoo.com
Whole thread Raw
In response to Oracle decode Function in Postgres  ("Amin Schoeib" <aschoeib@4tek.de>)
List pgsql-general
--- Amin Schoeib <aschoeib@4tek.de> wrote:
> Hi,
> Like I see there is no equivalent to the Oracle
> decode Function
> In Postgres.Is there maybe somebody who wrote decode
> as a
> Function?

The problem for any such body is that there is no one
function possible in PostgreSQL that will cover all of
the possible use cases of "decode" in Oracle.  As I
understand things, "decode" takes a variable number of
arguments, for a variety of datatypes.  In PostgreSQL
you would need to create a separate "decode" function
for every distinct set of arguments (number and
datatypes) that you are likely to encounter.  That
would be a lot of work for a generalized case.

You may be best served by searching your code for
usage of "decode", and writing only those versions
that you need.  The coding for each one would be
trivial, using "case" constructions.

>
> Schoeib
>
> 4Tek Gesellschaft f�r angewandte
> Informationstechnologien mbH
> Schoeib Amin
> Tel.  +49 (0) 69 697688-132
> Fax. +49 (0) 69 697688-111
> http://www.4tek.de
>
>


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

pgsql-general by date:

Previous
From: "Amin Schoeib"
Date:
Subject: Re: Localization (for dates) Oracle vs. Postgresql
Next
From: Alvaro Herrera Munoz
Date:
Subject: Re: Using oids