Re: Null Conversion

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mike Withers <M(dot)withers(at)uws(dot)edu(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Null Conversion
Date: 2001-08-15 01:30:34
Message-ID: Pine.BSF.4.21.0108141827210.71248-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 15 Aug 2001, Mike Withers wrote:

> Can anyone tell me how I might convert a null attribute value into a zero
> attribute value such that it can be multiplied in a query.
>
> In Oracle I could do:
>
> sal*12*NVL(COMM, 0) AS "Annual Income"
>
> where COMM is an attribute (a salesman commission, in an employes table)
> which has null values. This allows null commissions for non salesmen to
> give a zero calculated value. The NVL converts a null into zero.

Try coalesce(COMM, 0)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lee Harr 2001-08-15 02:02:03 Re: nextval, sequences and sequencenames
Previous Message Barry Lind 2001-08-15 01:23:02 Re: [ADMIN] initdb on postgresql 7.1.2 running under cygwin on win 2000