Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace procedure proc_move is
- id1 number;
- id2 number;
- cursor c_stanowisko is
- select distinct t.position as position
- from temp t;
- cursor c_specjalnosc is
- select distinct t.speciality as speciality
- from temp t;
- cursor c_pracownik is
- 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
- from temp t, Specjalnosc sp, Stanowisko st
- where st.position = t.position AND sp.speciality = t.speciality;
- begin
- for i in c_stanowisko loop
- insert into Stanowisko(position_ID, position)
- values (seq_Stanowisko.NEXTVAL, i.position);
- end loop;
- for j in c_specjalnosc loop
- insert into Specjalnosc(speciality_ID, speciality)
- values (seq_Specjalnosc.NEXTVAL, j.speciality);
- end loop;
- for k in c_pracownik loop
- insert into Pracownik(id, surname, name, birth, email, hire_date, salary, position_ID, speciality_ID)
- values (seq_Pracownik.NEXTVAL, k.surname, k.name, k.birth, k.email, k.hire_date, k.salary, k.position_id, k.speciality_id);
- end loop;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement