Re: Returning NULL results?

From: Richard Huxton <dev(at)archonet(dot)com>
To: mario(dot)splivalo(at)mobart(dot)hr
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Returning NULL results?
Date: 2005-10-11 14:39:21
Message-ID: 434BCE99.1040608@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mario Splivalo wrote:
>
> Of course, if it returns no rows, I'm presented with an error, saying:
>
> ERROR: record "rec" has no field "_qv"
>
> This is logical. My question would be is there a way around this
> withouth first doing SELECT COUNT(*) FROM tmbBids WHERE ..., and then if
> COUNT(*) is zero THEN bidCount := NULL ELSE if COUNT(*) is not zero then
> do SELECT from the begining?

Could you check the FOUND variable? As in IF NOT FOUND THEN RETURN NULL

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Landin Hostbaek 2005-10-11 15:11:05 Double query (limit and offset)
Previous Message Richard Huxton 2005-10-11 14:37:49 Re: ichar