Re: Providing an alternative result when there is no result

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Providing an alternative result when there is no result
Дата
Msg-id 20090518193656.GD7741@svana.org
обсуждение исходный текст
Ответ на Providing an alternative result when there is no result  (Joshua Berry <yoberi@gmail.com>)
Список pgsql-general
On Mon, May 18, 2009 at 03:13:56PM -0400, Joshua Berry wrote:
> Hello all,
>
> 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?
>
> Currently we select the result into a temp table.
>
> SELECT INTO temp_table id FROM ... ;

What might work is:

SELECT EXISTS(subquery);

As in:

SELECT EXISTS( SELECT 1 WHERE true );

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Providing an alternative result when there is no result
Следующее
От: David Wilson
Дата:
Сообщение: Re: Providing an alternative result when there is no result