Обсуждение: (non)zero function

Поиск
Список
Период
Сортировка

(non)zero function

От
Enrico Weigelt
Дата:
Hi folks,


is there an function returning true if the argument is null or 
zero (just to make some queries more concise). Of course its 
trivial to implement as SQL function, but if postgresql already
provides such a function, I would prefer using it. 


cu
-- 
---------------------------------------------------------------------Enrico Weigelt    ==   metux IT service
 phone:     +49 36207 519931         www:       http://www.metux.de/ fax:       +49 36207 519932         email:
contact@metux.decellphone: +49 174 7066481
 
----------------------------------------------------------------------- DSL ab 0 Euro. -- statische IP -- UUCP --
Hosting-- Webshops --
 
---------------------------------------------------------------------


Re: (non)zero function

От
Bruno Wolff III
Дата:
On Sun, Mar 27, 2005 at 17:58:07 +0200, Enrico Weigelt <weigelt@metux.de> wrote:
> 
> Hi folks,
> 
> 
> is there an function returning true if the argument is null or 
> zero (just to make some queries more concise). Of course its 
> trivial to implement as SQL function, but if postgresql already
> provides such a function, I would prefer using it. 

No.


Re: (non)zero function

От
Christian Kratzer
Дата:
Hi,

On Sun, 27 Mar 2005, Enrico Weigelt wrote:

>
> Hi folks,
>
>
> is there an function returning true if the argument is null or
> zero (just to make some queries more concise). Of course its
> trivial to implement as SQL function, but if postgresql already
> provides such a function, I would prefer using it.

Lookup the documentation on COALESCE()

http://www.postgresql.org/docs/current/static/functions-conditional.html
9.13.2. COALESCE

Greetings
Christian

-- 
Christian Kratzer                       ck@cksoft.de
CK Software GmbH                        http://www.cksoft.de/
Phone: +49 7452 889 135                 Fax: +49 7452 889 136