From: | "Emils Klotins" <emils(at)mail(dot)usis(dot)bkc(dot)lv> |
---|---|
To: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | CASE WHEN / 6.4.2? + no doc in installed documentation |
Date: | 1999-05-26 15:50:09 |
Message-ID: | 199905261245.PAA07938@omega.bkc.lv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello.
Could somebody please tell what is the correct form for either IFNULL or CASE SQL functions
in PG?
I have a SELECT that needs to return a value, if another value is not null, otherwise it should
return a string 'N/A':
A simpliefied version of SELECT is this:
SELECT category, CASE (WHEN category IS NULL THEN 'N/A' ELSE name) AS name FROM
mytable;
I get 'parse error near category'.
What would be the correct form or alternate way to do this?
Thanks in advance for any help!!
NB. SQL functions are NOT mentioned at all in the PG documentation which comes with the
6.4.2 version in SuSE 6.1 Linux. I only found it in the "User's guide", section 6 of the PG
documentation on Postgresql.org web site.
------------------------------------------------
Emils.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Message of the day:
Ambition is a poor excuse for not having enough sense to be lazy.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
RSA PGP key published on: http://pgpkeys.mit.edu:11371
From | Date | Subject | |
---|---|---|---|
Next Message | JT Kirkpatrick | 1999-05-26 17:49:12 | select nextval. . . |
Previous Message | Tom Lane | 1999-05-26 14:07:41 | Re: [SQL] CASE WHEN / 6.4.2? + no doc in installed documentation |