Re: plpgsql loop not returning value - Mailing list pgsql-general

From Josh Close
Subject Re: plpgsql loop not returning value
Date
Msg-id 4a0cafe204101607301152c6d2@mail.gmail.com
Whole thread Raw
In response to Re: plpgsql loop not returning value  (Michael Fuhr <mike@fuhr.org>)
Responses Re: plpgsql loop not returning value
List pgsql-general
On Sat, 16 Oct 2004 00:59:34 -0600, Michael Fuhr <mike@fuhr.org> wrote:
> Add some RAISE INFO statements to print variables' values at key
> places.  I wonder if one of your SUMs is returning NULL, causing
> your addition to evaluate to NULL.  If so, then perhaps you should
> use COALESCE to turn those NULLs into zeros.
>
> If I've misunderstood the problem then please clarify.
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/

Thanks. That's exactly what was happening. I'm still new to postgres.
This is actually the first function I've wrote. I didn't even know
about RAISE or COALESCE. I added them both and it works great now!

Thanks.

-Josh

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Avoiding sequential scans with OR join condition
Next
From: "Mark Dexter"
Date:
Subject: Re: Complex Update Queries with Fromlist