Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CASE statement inside DECODE

ChaitanyaGoparajuMar 7 2011 — edited Mar 7 2011
Hi All,

I am trying to use a CASE logic inside a DECODE function while selecting data from a table. But unable to get the correct syntax. Is there something that I might be missing?

My snippet looks like -
SELECT DECODE(CASE WHEN COL2 > 10 THEN 'HIGH', WHEN COL2 < 10 THEN 'LOW' END RANGEVALUE, 'HIGH', 'YES','LOW','NO','N/A')
FROM TEST_TABLE;
My table looks like -

TEST_TABLE
------------------
COL1 VARCHAR2(10),
COL2 NUMBER(8,0)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 4 2011
Added on Mar 7 2011
10 comments
12,879 views