Re: pgplsql - Oracle nvl

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Christian Traber <christian(at)traber-net(dot)de>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgplsql - Oracle nvl
Date: 2003-08-27 09:19:15
Message-ID: 1061975956.5230.25.camel@coppola.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OK, clear.
But if you have access to your application code, it's maybe better to
create an abstraction layer in front of the DB specific SQLs, and
implement for each DB differently (this is how we do it).
The "nvl" and "decode" statements are Oracle specific, so I can't see
why not use the Postgres specific syntax for Postgres. A lot of Oracle
queries will work a lot better on postgres if rewritten differently, and
some of them can be even expressed more elegantly in Postgres. AFAIKT,
designing your application so it can use a DB abstraction layer will
give you far less trouble in the long run than trying to make the Oracle
queries work unchanged on Postgres...

Cheers,
Csaba.

On Wed, 2003-08-27 at 10:55, Christian Traber wrote:
> I know this functions, but I do not want to change the statements in my
> old application.
> So I want to make the functions with the Oracle names for compatibility.
>
> Best regards,
> Christian
>
> Csaba Nagy wrote:
>
> >You don't need to build any function for this, you have them ready:
> >http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-conditional.html#AEN9753
> >http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-conditional.html#AEN9698
> >
> >Cheers,
> >Csaba.
> >
> >On Wed, 2003-08-27 at 09:58, Christian Traber wrote:
> >
> >
> >>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 works for every datatype?
> >>
> >>Best regards,
> >>Christian
> >>
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 6: Have you searched our list archives?
> >>
> >> http://archives.postgresql.org
> >>
> >>
> >
> >
> >
> >
> >
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Amin Schoeib 2003-08-27 09:43:15 Localization Oracle vs. Postgresql
Previous Message Christian Traber 2003-08-27 08:55:02 Re: pgplsql - Oracle nvl