Re: Oracle decode Function in Postgres

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Amin Schoeib <aschoeib(at)4tek(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: Oracle decode Function in Postgres
Date: 2003-09-03 14:41:12
Message-ID: 20030903144112.82978.qmail@web20809.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- Amin Schoeib <aschoeib(at)4tek(dot)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 fr 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Eckermann 2003-09-03 14:44:34 Re: Trunc in Postgres
Previous Message Bill Montgomery 2003-09-03 14:38:52 syntax error in eRServer.pm line 69