473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Oracle decode Function in Postgres

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?

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
Nov 11 '05 #1
2 14890
Of course there is an equivalent: the case construct.
There is some nice documentation about the available functions and
operators at:
http://www.postgresql.org/docs/view....functions.html
and specifically for CASE:
http://www.postgresql.org/docs/view....l.html#AEN9698
You might also find useful to know that the NVL oracle function's
parallel in postgres is COALESCE.

HTH,
Csaba.

On Wed, 2003-09-03 at 11:00, Amin Schoeib 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?

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


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #2
--- Amin Schoeib <as******@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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: etravels | last post by:
Hiyas I am currently working on Oracle Report which ties in with my a report in the ebusiness suite of Oracle telesales module. Basically, the address on statement reports have blank fields...
0
by: longhorntx | last post by:
I have a table with following values City STATE COLOR REGION city1 Texas White SW city2 Texas Gray SW city3 Texas Gray SW city4 Nevada Gray PAC c5 Texas Yellow SW c6 Florida Yellow SE...
5
by: Christian Traber | last post by:
Hi, I'll try to switch from Oracle to postgres for some small applications. Is it possible to build functions like Oracle's nvl or decode with pgplsql? How can I make a function like nvl that...
1
by: Eric | last post by:
Hi, I would like to know if a daemon exist to intercept Oracle queries and translate to postgresql query... I have a windows app (AccPac) that connect to an Oracle server via ODBC. I would...
1
by: Michael John | last post by:
Dear Oracle Developers, my task is to make up a Oracle View from a Pivot table in MS Access. Given are two tables to join: T_FIRM: FIRM_ABBR VARCHAR2(3 BYTE), FIRM_LONG ...
2
by: Shah, Sameer | last post by:
Hi All, I would appreciate any input on this dilemma: 1. I have DataBase-A which is Oracle on Server A with FunctionA (PLSQL)
16
by: Medhatithi | last post by:
Hi, I am facing a strange problem with decode function in oracle. My table name is status_hist. Below is the query I am hitting on this table: select...
0
by: sergio311 | last post by:
Hi all, i'm a newbe of oracle, and i've installed oracle database server 10g on my fedora5 SO. I use PostgreSQL, but now i want migrate to oracle and, obviously, i've encountered some problem. My...
1
ollyb303
by: ollyb303 | last post by:
Hello, I have been using the following expression in Access as part of a statement to query an Oracle database: (Sum(CASE WHEN STATS_DAILY_SA.LOGIN_TIME > (STATS_DAILY_SA.SCHEDULED_TIME -...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.