Code
Begin declare c anchor empPr.salary; select salary into c from empPr where id=2; if(c>40000) then
update empPr set salary=c+1000 where id=2;
end if; end
Code
begin declare c anchor empPr.salary;
select salary into c from empPr where id=2 ;if(c>40000) then
update empPr set salary=c+1000 where id=2;else
update empPr set salary=c+500 where id=2;end if;
end ;
Codebegin
declare c anchor empPr.salary; declare bonus int; select salary into c from empPr where id=2 ; case c
when 50000 then set bonus=c+1000; when 30000 then set bonus=c+500; else set bonus=c;
end case; update empPr set salary=bonus where id=2;
end ;
Codebegin
declare c anchor empPr.salary; declare bonus int; select salary into c from empPr where id=2 ; case
when C<=40000 then set bonus=c+500;
when c<=50000 then set bonus=c+1000;
else set bonus=c+2000;
end case; update empPr set salary=bonus where id=2;
end ;
Code
create type emp as row anchor row of empPr; BEGIN declare e1 emp;
L : for e1 as select * from empPr DO
if( e1.salary < 30000) THEN Iterate L;
end if; update empPr set salary=e1.salary+1000 where
id=e1.id; end for L;
END;
Codecreate type e1 as row anchor row of empPr;BEGIN
declare total_sal int; set total_sal = 0; ADD :
for e1 as select * from empPr DO Set total_sal=total_sal+e1.salary; if( total_sal >100000)
leave ADD: end if;
end for ADD; END;
8