Oracle CASE function (Similar to Select Case or Switch Case )

From: aany <aanymg_at_music.com>
Date: 10 Aug 2001 00:40:20 -0700
Message-ID: <a5d6647d.0108092340.2ced456c_at_posting.google.com>


This just for information. Now CASE function (Oracle version 8.1.6) can be used in sql statements. (Similar to Select Case or Switch Case )

Example :

SELECT AVG ( CASE

             WHEN EMP.SAL > 2000 THEN 
                EMP.SAL
             ELSE  
                2000
             END )

FROM EMP ; This cannot be used in PL/SQL statement. If at all it has to be used, then assing the statement to a variable and execute the statement using EXECUTE IMMEDIATE command.

If there are any improvements over this, pl post them. Received on Fri Aug 10 2001 - 09:40:20 CEST

Original text of this message