Thread: (non)zero function

(non)zero function

From
Enrico Weigelt
Date:
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

From
Bruno Wolff III
Date:
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

From
Christian Kratzer
Date:
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