Skip site navigation (1) Skip section navigation (2)

Re: coalesce and nvl question

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Simon Windsor <simon(dot)windsor(at)cornfield(dot)org(dot)uk>
Cc: Mike Mascari <mascarm(at)mascari(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: coalesce and nvl question
Date: 2004-06-23 18:43:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Wed, Jun 23, 2004 at 19:10:05 +0100,
  Simon Windsor <simon(dot)windsor(at)cornfield(dot)org(dot)uk> wrote:
> Hi
> I understand that null and '' are different, and MySQL and Oracle
> functions are confusing, but my question was not about replacing NULL
> but replacing Empty strings. These are handled in MySQL/Oracle by the
> same functions that do NULL checks.
> Is there a standard function in Postgres that replaces Empty strings, as
> against a NULL value.

Something like the following may suit your purposes:
coallesce(nullif(inputstring,''), 'replacement value')

In response to


pgsql-general by date

Next:From: Lynna LandstreetDate: 2004-06-23 18:50:40
Subject: woes and looking for a new host
Previous:From: Bruno Wolff IIIDate: 2004-06-23 18:36:23
Subject: Re: insert with select as value

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group