Subject | Re[2]: [firebird-support] NULLS in VIEW when adding values |
---|---|
Author | Pavel Menshchikov |
Post date | 2006-03-12T07:48:17Z |
Hello Erik,
EDL> Is there any reason why the IF doesn't work, or is it just a design decision.
CASE is more "general" statement: if you refer to its syntax
description, you'll see that you can use constructions like
-----
SELECT
o.ID,
o.Description,
CASE
WHEN (o.Status IS NULL) THEN 'new'
WHEN (o.Status = 1) THEN 'confirmed'
WHEN (o.Status = 3) THEN 'in production'
WHEN (o.Status = 4) THEN 'ready'
WHEN (o.Status = 5) THEN 'shipped'
ELSE 'unknown status ''' || o.Status || ''''
END
FROM
Orders o
-----
(the example is from the README.case doc file)
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com
EDL> Is there any reason why the IF doesn't work, or is it just a design decision.
CASE is more "general" statement: if you refer to its syntax
description, you'll see that you can use constructions like
-----
SELECT
o.ID,
o.Description,
CASE
WHEN (o.Status IS NULL) THEN 'new'
WHEN (o.Status = 1) THEN 'confirmed'
WHEN (o.Status = 3) THEN 'in production'
WHEN (o.Status = 4) THEN 'ready'
WHEN (o.Status = 5) THEN 'shipped'
ELSE 'unknown status ''' || o.Status || ''''
END
FROM
Orders o
-----
(the example is from the README.case doc file)
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com