Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //zadanie 257
- DECLARE CURSOR c_studenci IS
- SELECT
- id_student,
- nazwisko,
- imie
- FROM
- studenci;
- currentnumber NUMBER;
- FUNCTION Sumpoints (pids studenci.id_student % TYPE) RETURN NUMBER IS points NUMBER;
- BEGIN
- SELECT
- SUM(punkty) INTO points
- FROM
- egzaminy
- WHERE
- id_student = pids;
- IF points IS NULL THEN points := -1;
- END IF;
- RETURN points;
- END;
- BEGIN FOR student IN c_studenci LOOP currentnumber := Sumpoints(student.id_student);
- IF currentnumber >= 0 THEN DBMS_OUTPUT.Put_line(
- student.nazwisko || ' ' || student.imie || ' uzyskal ilosc pkt: ' || currentnumber
- );
- ELSE DBMS_OUTPUT.Put_line(
- student.nazwisko || ' ' || student.imie || ' nie podchodzil do egzaminu'
- );
- END IF;
- END LOOP;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement