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.