Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

4 views
Skip to first unread message

aany

unread,
Aug 10, 2001, 3:40:20 AM8/10/01
to
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.

0 new messages