Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace procedure zad1(rocznik student.rok%type, srednia integer)
- is
- sredniaStudenta integer;
- wszystkieOceny integer;
- idStudent integer;
- rokStudenta student.rok%type;
- cursor Cur_zad1 is select idstudenta from ocena;
- begin
- open Cur_zad1;
- loop
- fetch Cur_zad1 into idStudent
- exit when Cur_zad1%NOTFOUND;
- select rok
- into rokStudenta
- from student
- where idstudenta = idStudent;
- if rokStudenta = rocznik
- then
- select sum(wartosc)
- into wszystkieOceny
- from ocena
- where idstudenta = idStudent;
- sredniaStudenta := avg(wszystkieOceny);
- if sredniaStudenta < srednia
- then
- delete from student where idstudenta = idStudent;
- delete from ocena where idstudenta = idStudent;
- end if
- end if
- end loop;
- close Cur_zad1;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement