From: | "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it> |
---|---|
To: | general postgres <pgsql-general(at)PostgreSQL(dot)org> |
Subject: | COALESCE() or NVL() |
Date: | 1998-06-12 10:53:12 |
Message-ID: | Pine.LNX.3.96.980612102925.648B-100000@proxy |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Hi all,
I'm looking for a function like COALESCE() or the Oracle NVL(),
to returns a ZERO value instead of a NULL value.
To have the result: NULL+1 = 1 instead of NULL+1 = NULL
Have PostgreSQL something like this ?
I tried to write it on C but I can't realize the beavior of NULLs,
I can't get that my program returns a zero instead of a null.
I'm not a C programmer, could somebody help me ?
SELECT * FROM emp;
name |salary|age|dept
-----------+------+---+-----
Sam | 1200| 16|toy
Claire | 5000| 32|shoe
Bill | 4200| 36|shoe
Ginger | 4800| 30|candy
NULL VALUES| | |
(5 rows)
SELECT name,NVL(salary)+100 AS dream FROM emp;
name |dream
-----------+-----
Sam | 1300
Claire | 5100
Bill | 4300
Ginger | 4900
NULL VALUES| <--- I expected 100 here.
(5 rows)
Thanks, Jose'
| |
~~~~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~~~~~~~~
Progetto HYGEA ---- ---- www.sferacarta.com
Sfera Carta Software ---- ---- sferac(at)bo(dot)nettuno(dot)it
Via Bazzanese, 69 | | Fax. ++39 51 6131537
Casalecchio R.(BO) Italy | | Tel. ++39 51 591054
From | Date | Subject | |
---|---|---|---|
Next Message | Byron Nikolaidis | 1998-06-12 14:13:33 | Re: [GENERAL] PostgreSQL/ODBC/WinNT? |
Previous Message | Brett W. McCoy | 1998-06-12 01:51:51 | Re: [GENERAL] PostgreSQL/ODBC/WinNT? |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-06-12 11:31:28 | Re: [HACKERS] now 6.4 |
Previous Message | Lendvary Gyorgy | 1998-06-12 08:30:17 | update by one transaction |