Re: Using expressions w/ DECODE?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/08/01
Message-ID: <965153953.20935.0.pluto.d4ee154e_at_news.demon.nl>#1/1


If you use the sign function in your decode, you can use ranges. decode(sign(logins - 5), 0, ..., -1, ...) etc.

Hth,

[Quoted] Sybrand Bakker, Oracle DBA

<louster_at_my-deja.com> wrote in message news:8m4v6k$kr7$1_at_nnrp1.deja.com...
> I'd like to write a sql statement labeling users to my website
> as "active", "frequent" or "power" depending on how many times they've
> logged in. Oracle SQL doesn't have an IF-THEN statement and DECODE
> doesn't let you use expressions (eg. < 5 logins = 'active user',
> 5>logins>25 = 'active user', > 25 logins = 'power user'). I was
> thinking of getting 3 result sets and using UNION to combine them but
> the query is very expensive. There has got to be a way to do this. Any
> ideas?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Aug 01 2000 - 00:00:00 CEST

Original text of this message