-
Hi friends,
I though this might help all of us.
If i want to write a if then elsif statement in single statement informing me that if my sal is less than 2000 it would give me high, if it is less than 2000 then low , if it is less then 1000 then low..
I have written a select statement. I will be glad to have improvements on this select statement..
SELECT EMPNO,SAL,DECODE(SIGN(SAL-2000),-1,(DECODE(SIGN(SAL-1000),1,'MIDDLE',-1,'LOW')),'HIGH') from emp..
When the going gets tough, the tough gets going
-
try this
SELECT empno, ename, job, sal,
DECODE(SIGN(sal-2000),1,'HIGH',-1,'LOW',0,'MIDDLE')
FROM emp;
thnx,
Cheers!
OraKid.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|