wiktorek140

Untitled

May 8th, 2021
797
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE
  2. CURSOR CStudent IS SELECT ID_Student, Nazwisko, Imie FROM Studenci;
  3.  
  4. FUNCTION PDodStudent (pId VARCHAR2) RETURN NUMBER IS
  5. x NUMBER;
  6. BEGIN
  7.    
  8.     SELECT SUM(Punkty) INTO x FROM Egzaminy WHERE ID_Student = pId;
  9.    
  10.     IF x IS NULL THEN RETURN -1;
  11.     ELSE
  12.         RETURN x;
  13.     END IF;
  14.    
  15. END PDodStudent;
  16.  
  17. BEGIN
  18.  
  19.     FOR vC IN CStudent LOOP
  20.         DBMS_OUTPUT.put_line(PDodStudent(vc.Id_Student)) ;
  21.     END LOOP;
  22.  
  23. END ;
  24.  
  25.  
RAW Paste Data