i want to use case in update clause. i have used case in select stmt referring answer in this site. but the same syntax is not working for update stmt.my problem is update emp set case deptno when 10 then 20 when 20 then 30 when 30 then 40 when 40 then 10 else 0 end where deptno in(10,20,30,40); But it is not working. slightly change in the syntax working but for first condition only update emp set deptno=(case when 10 then 20 when 20 then 30 when 30 then 40 when 40 then 10 else 0)end;
update emp set deptno= case when deptno= 10 then deptno* 20 when deptno= 20 then deptno* 30 when deptno= 30 then deptno* 40 when deptno= 40 then deptno* 10 else deptno* 0 end
thanks friend i got the query for case in update right.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.