Advertisement
Guest User

Dragosi_sub_Pl/SQL

a guest
Apr 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. set serveroutput on
  2.  
  3. declare
  4. type my_col is varray(100) of number;
  5. v_vect my_col :=my_col();
  6.  
  7. type tip_meu is record(
  8. nr_com comenzi.nr_comanda%type,
  9. val rand_comenzi.pret%type,
  10. dat date);
  11.  
  12. type index_tb_meu is table of tip_meu index by pls_integer;
  13. colectie_inreg index_tb_meu;
  14. begin
  15. null;
  16. for i in 1..5 loop
  17. v_vect.extend;
  18. v_vect(i):=i+1998;
  19. end loop;
  20.  
  21. for i in v_vect.first..v_vect.last loop
  22. dbms_output.put_line(v_vect(i));
  23. select c.nr_comanda,sum(rc.pret*rc.cantitate) as valoare,c.data bulk collect into colectie_inreg from comenzi c, rand_comenzi rc
  24. where c.nr_comanda =rc.nr_comanda and extract (year from c.data) = v_vect(i)
  25. group by c.nr_comanda,c.data;
  26. if sql%notfound then dbms_output.put_line('Nu exista comenzi in anul '||v_vect(i));
  27. else
  28. for j in 1..colectie_inreg.count loop
  29. null;
  30. dbms_output.put_line(colectie_inreg(j).nr_com||' '||colectie_inreg(j).val);
  31. end loop;
  32. end if;
  33. end loop;
  34. end;
  35. /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement