case [message #374844] |
Thu, 05 July 2001 23:22 |
ravibabu
Messages: 12 Registered: July 2001
|
Junior Member |
|
|
how do we use CASE in oracle?
if i am using case like this i am gettting the following error
SQL> SELECT ename, CASE WHEN sal>1000 THEN 'Over paid' ELSE 'Under paid' END
2 FROM emp;
SELECT ename, CASE WHEN sal>1000 THEN 'Over paid' ELSE 'Under paid' END
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
|
|
|
Re: case [message #374845 is a reply to message #374844] |
Thu, 05 July 2001 23:37 |
Rajasekar.N
Messages: 3 Registered: July 2001
|
Junior Member |
|
|
Use Decode function in Oracle. It would be like this:
SELECT ename, DECODE(sign(sal-1000),1,'Over Paid','Under Paid') SalCategory FROM emp;
|
|
|
|
|
|