Skip site navigation (1) Skip section navigation (2)

CASE WHEN

From: Luiz Eduardo Cantanhede Neri <lecneri(at)gmail(dot)com>
To: postgresql novice <pgsql-novice(at)postgresql(dot)org>
Subject: CASE WHEN
Date: 2009-06-09 14:53:58
Message-ID: 252e1f290906090753u79e37ef9kfe78091129f3d7f1@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi guys,

Just a simple question.

It's known that in SQL field = NULL is diferrent from from field IS NULL.
Does the same rule applies when you use CASE .. WHEN statement ?

e.g.
CASE myField
WHEN IS NULL THEN....


From my tests, shows this sintaxt is incorrect so I replaced to
CASE myField
WHEN NULL THEN ...

this 2nd example worked so far, but I'm worried about that isn't correct way
of doing it and may generate some failure returning rows with inconsistent
data.
So, you guys know if using this way is a valid CASE/WHEN sentence?

I know also there's
CASE
WHEN myField IS NULL THEN ...

but I'm asking about the 2nd way to make it clear to me.

Thx

pgsql-novice by date

Next:From: brucejhyattDate: 2009-06-11 00:34:28
Subject: Re: Yum Update Errors
Previous:From: Merlin MoncureDate: 2009-06-09 14:34:27
Subject: Re: Why lots of temp schemas are being created

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group