Re: How to pickup null values in SQL Language?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tahira Aslam <tahira_aslam(at)yahoo(dot)com>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to pickup null values in SQL Language?
Date: 2002-05-31 05:54:56
Message-ID: 20020530225301.E51109-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 30 May 2002, Tahira Aslam wrote:

> Select Coalesce(cast(MyView."Document_ID" as
> Text)||','||cast(MyView."First_Name" as
> Text)||','||cast(MyView."Last_Name" as
> Text)||','||cast(MyView."Sent_Date" as Text),'NONE') From "MyView"
> Where "Document_ID"=$1;

If you want a part of the string to become NONE if null, you need
to coalesce each part (I'm dropping the casts for now):
select coalesce(MyView."Document_ID", 'None') || ',' ||
coalesce(MyView."First_Name", 'None') || ...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tahira Aslam 2002-05-31 06:18:38 Re: How to pickup null values in SQL Language?
Previous Message Kay-Uwe Michaelis 2002-05-31 05:47:40 How to rebuild tables