Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE
- points NUMBER;
- CURSOR all_student_ids IS SELECT s.ID_STUDENT FROM STUDENCI s;
- FUNCTION get_student_score (p_id_student NUMBER) RETURN NUMBER IS
- score NUMBER;
- BEGIN
- SELECT NVL(SUM(punkty), 0) INTO score FROM egzaminy WHERE ID_STUDENT = p_id_student;
- RETURN score;
- END get_student_score;
- BEGIN
- FOR student IN all_student_ids LOOP
- points := get_student_score(student.id_student);
- IF points != 0 THEN
- DBMS_OUTPUT.put_line('Suma punktów studenta o ID ' || student.id_student || ': ' || points);
- ELSE
- DBMS_OUTPUT.put_line('Student o ID ' || student.id_student || ' nie zdawał egzaminu');
- END IF;
- END LOOP;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement