Re: Replace null values

From: Ian Haywood <ihaywood(at)iinet(dot)net(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Replace null values
Date: 2010-03-23 06:45:54
Message-ID: e79877201003222345u783253bcq510504745e9b3b9d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 23, 2010 at 5:33 PM, Nilesh Govindarajan <lists(at)itech7(dot)com> wrote:
> On 03/23/2010 11:47 AM, John R Pierce wrote:
>>
>>> How to convert zero length string to null ?
>>
>>
>>
>> UPDATE yourtable SET name=NULL WHERE name='';
>>
>>
>
> No I don't want to replace it in the table. Just in the query result.
use a CASE construct.
select case name='' then null else name end from table where ......

Ian

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nilesh Govindarajan 2010-03-23 06:54:07 Re: Replace null values
Previous Message Nilesh Govindarajan 2010-03-23 06:33:59 Re: Replace null values