Re: PL/PGSQL question

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PL/PGSQL question
Date: 2003-01-17 06:21:47
Message-ID: 3E27A0FB.30400@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
>
> SUM() over no rows returns NULL, not zero, per the SQL spec.

I knew that, but didn't see the implications ... i.e. "IF FOUND" always
returns true ...

> Try testing total_sales for NULL instead.

I was thinking of that but I declared it of type INTEGER. I thought it
made no sense to have an integer with a NULL value but it it works, I'm
happy :)

Thanks!

Jc

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2003-01-17 06:33:48 PL/PGSQL: another Q
Previous Message Tom Lane 2003-01-17 06:20:48 Re: PL/PGSQL question