Home » RDBMS Server » Server Administration » Re: DECODE function
Re: DECODE function [message #373156] Fri, 30 March 2001 02:43
Phenoracle
Messages: 35
Registered: March 2001
Member
Hi,

Here is a simple but effective example of how to use range with decode.

1 select deptno, decode(least(deptno, 20), greatest(deptno, 10), 1, deptno)
2* from emp
SQL> /

DEPTNO DECODE(LEAST(DEPTNO,20),GREATEST(DEPTNO,10),1,DEPTNO)
--------- -----------------------------------------------------
20 1
30 30
30 30
20 1
30 30
30 30
10 1
20 1
10 1
30 30
20 1
30 30
20 1
10 1
10 1

15 rows selected.

Great isn't it.

Hope this is of help

Phenoracle
Previous Topic: Re: Concatenation operator
Next Topic: ROWID error
Goto Forum:
  


Current Time: Mon Dec 23 05:21:26 CST 2024