Re: Providing an alternative result when there is no result

From: Reece Hart <reece(at)harts(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Providing an alternative result when there is no result
Date: 2009-05-18 19:33:15
Message-ID: 1242675195.5741.32.camel@snafu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2009-05-18 at 15:13 -0400, Joshua Berry wrote:

> Is there an easy and efficient way to return a boolean false for a
> query that returns no result, and true for one that does return a
> result?

Presuming that you're not using the values in temp_table, I think you
should be using PERFORM * WHERE ...; and then IF FOUND ... ELSE ... END
IF;

See here:
http://www.postgresql.org/docs/8.3/static/plpgsql-statements.html
and also follow link to 38.5.5 .

-Reece

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2009-05-18 19:36:56 Re: Providing an alternative result when there is no result
Previous Message Karsten Hilbert 2009-05-18 19:32:42 Re: Need help