Re: Replace null values

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Replace null values
Date: 2010-03-23 04:37:04
Message-ID: 4BA84570.2090000@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Nilesh Govindarajan wrote:
> Hi,
>
> In my query, some rows have null values (length 0).

a NULL value is not length 0, NULL is not the empty string, rather, NULL
is no value at all.

if you want to change a 0 length string to something, use a CASE or
something.

select CASE WHEN u.name = '' THEN 'anon' ELSE u.name, ....

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nilesh Govindarajan 2010-03-23 04:39:16 Re: Replace null values
Previous Message Nilesh Govindarajan 2010-03-23 04:11:44 Replace null values