Case with Char(1)

From: "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Case with Char(1)
Date: 2007-02-28 13:02:38
Message-ID: 55c095e90702280502x3673fe6g67e7cb5de714356f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi list,

it is possible to use case with character (1) ?

I am having problems to formate the SQL statement.

I have:

SELECT * FROM test;

a
---
A
B
C

SELECT a,
CASE WHEN a='A' THEN 'one'
WHEN a='B' THEN 'two'
ELSE 'other'
END
FROM test;

a | case
---+-------
A | one
B | two
C | other

I know from all program languages that case do not apply to noun
sequencialiable (if this word exists) variable (like integers etc).

Any help would be greatfull.

Thanks in advance
Ezequias

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-02-28 13:18:43 Re: Case with Char(1)
Previous Message Andreas Joseph Krogh 2007-02-28 11:23:26 Re: Conditional NOT NULL constraint