-
Hi all,
How to use the CASE in the SQL statements. I tried the following example but it does not work.
SQL> ED
Wrote file afiedt.buf
1 DECLARE X
2 X:=1;
3 BEGIN
4 select AVG(CASE WHEN t.f2 > 6000 then t.f2 ELSE 6000 END) from temp t;
5 END;
6* .
SQL> /
select AVG(CASE WHEN t.f2 > 6000 then t.f2 ELSE 6000 END) from temp t;
*
ERROR at line 4:
ORA-06550: line 4, column 12:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( - + all mod null
avg
count current distinct max min prior sql stddev sum unique
variance execute cast trim forall
Can use the CASE in the UPDATE statement as well and how?
Please advice.
Thanks
-
You might be using an incorrect oracle version.
[Edited by kris109 on 03-08-2002 at 04:30 PM]
-
You're right.
I did the test on the Oracle 8.1.5. , then I used Oracle 8.1.7 and it works.
Thank u very much