pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emils Klotins <emils@mail.usis.bkc.lv>
To: pgsql-sql@postgreSQL.org
Subject: CASE WHEN / 6.4.2? + no doc in installed documentation
Date: Wed, 26 May 1999 15:50:09 EET
Message-ID: <199905261245.PAA07938@omega.bkc.lv> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <199905261245.PAA07938@omega.bkc.lv>
Permalink:  ../199905261245.PAA07938@omega.bkc.lv/
Also on:    postgresql.org/message-id/199905261245.PAA07938@omega.bkc.lv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: emils@mail.usis.bkc.lv
  Subject: Re: CASE WHEN / 6.4.2? + no doc in installed documentation
  In-Reply-To: <199905261245.PAA07938@omega.bkc.lv>
  References: <199905261245.PAA07938@omega.bkc.lv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox