Advertisement
Guest User

Untitled

a guest
May 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. create or replace function medieAtribut(
  2. what in VARCHAR2
  3. )return float
  4. AS
  5. suma float;
  6. counnt int;
  7. CURSOR cur_product
  8. IS
  9. SELECT
  10. *
  11. FROM
  12. pacienti;
  13. BEGIN
  14. suma :=0;
  15. counnt :=0;
  16. FOR pacient IN cur_product
  17. LOOP
  18. if getValoare(pacient.id_pacient,what)!=-1
  19. then counnt := counnt + 1;
  20. end if;
  21. END LOOP;
  22.  
  23. FOR pacient IN cur_product
  24. LOOP
  25. if getValoare(pacient.id_pacient,what)!=-1 then
  26. suma := suma + getValoare(pacient.id_pacient,what);
  27. end if;
  28. END LOOP;
  29.  
  30. DBMS_OUTPUT.PUT_LINE(suma);
  31. RETURN suma/counnt;
  32. END medieAtribut;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement