Re: if-clause to an exiting statement

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: if-clause to an exiting statement
Дата
Msg-id 201012070736.49868.adrian.klaver@gmail.com
обсуждение исходный текст
Ответ на Re: if-clause to an exiting statement  ("kobi.biton" <kobi@comns.co.il>)
Ответы Re: if-clause to an exiting statement  (Kobi Biton <kobi@comns.co.il>)
Список pgsql-general
On Tuesday 07 December 2010 3:58:46 am kobi.biton wrote:
> hi thanks for the reply I did look at the CASE statement however cannot
> seem to alter the returned row-count ...
>
>   CASE WHEN (@@ROW-COUNT = 0) THEN
>
>      [what do I write here?]  @@ROW-COUNT = 1?
>
>   END
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/if-clause-to-an-exiting-statement-t
>p3295519p3295641.html Sent from the PostgreSQL - general mailing list
> archive at Nabble.com.

See below:

test=> SELECT count(*) from bool_test ;
 count
-------
    33
(1 row)

test=> SELECT count(*) ,
case count(*) when 0
  then 1
else
  count(*)
end
from
  bool_test ;

 count | count
-------+-------
    33 |    33
(1 row)

test=> SELECT count(*) ,
case count(*) when 0
  then 1
else
  count(*)
end
from
  bool_test
where
  ifd=0;

 count | count
-------+-------
     0 |     1
(1 row)


--
Adrian Klaver
adrian.klaver@gmail.com

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

Предыдущее
От: Dmitriy Igrishin
Дата:
Сообщение: Re: Do we want SYNONYMS?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: regexp err msg question