Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. create or replace procedure proc_move is
  2. id1 number;
  3. id2 number;
  4. cursor c_stanowisko is
  5. select distinct t.position as position
  6. from temp t;
  7. cursor c_specjalnosc is
  8. select distinct t.speciality as speciality
  9. from temp t;
  10. cursor c_pracownik is
  11. select distinct t.email as email, t.surname as surname, t.name as name, t.birth as birth, t.salary as salary, t.hire_date as hire_date, sp.speciality_ID as speciality_id, st.position_ID as position_id
  12. from temp t, Specjalnosc sp, Stanowisko st
  13. where st.position = t.position AND sp.speciality = t.speciality;
  14. begin
  15. for i in c_stanowisko loop
  16. insert into Stanowisko(position_ID, position)
  17. values (seq_Stanowisko.NEXTVAL, i.position);
  18. end loop;
  19. for j in c_specjalnosc loop
  20. insert into Specjalnosc(speciality_ID, speciality)
  21. values (seq_Specjalnosc.NEXTVAL, j.speciality);
  22. end loop;
  23. for k in c_pracownik loop
  24. insert into Pracownik(id, surname, name, birth, email, hire_date, salary, position_ID, speciality_ID)
  25. values (seq_Pracownik.NEXTVAL, k.surname, k.name, k.birth, k.email, k.hire_date, k.salary, k.position_id, k.speciality_id);
  26. end loop;
  27. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement