Unit2

486 views
459 views

Published on

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
486
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Unit2

  1. 1. CodeBegin 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
  2. 2. Codebegin 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 ;
  3. 3. 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 ;
  4. 4. 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 ;
  5. 5. Codecreate 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;
  6. 6. 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;
  7. 7. 8

×