Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. create or replace procedure zad1(rocznik student.rok%type, srednia integer)
  2. is
  3. sredniaStudenta integer;
  4. wszystkieOceny integer;
  5. idStudent integer;
  6. rokStudenta student.rok%type;
  7. cursor Cur_zad1 is select idstudenta from ocena;
  8. begin
  9. open Cur_zad1;
  10. loop
  11. fetch Cur_zad1 into idStudent
  12. exit when Cur_zad1%NOTFOUND;
  13.  
  14. select rok
  15. into rokStudenta
  16. from student
  17. where idstudenta = idStudent;
  18.  
  19. if rokStudenta = rocznik
  20. then
  21. select sum(wartosc)
  22. into wszystkieOceny
  23. from ocena
  24. where idstudenta = idStudent;
  25.  
  26. sredniaStudenta := avg(wszystkieOceny);
  27.  
  28. if sredniaStudenta < srednia
  29. then
  30. delete from student where idstudenta = idStudent;
  31. delete from ocena where idstudenta = idStudent;
  32. end if
  33. end if
  34. end loop;
  35. close Cur_zad1;
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement