So my code should copy a few columns from two tables and insert them into a new another one but when i check the table afterwards it returns the primary key with
alot of other columns. The primary key is a car plate number so it should be unique. Pnr is also a primary key but i think i didnt see any multiplied ones. This is my code:
declare
cursor c_fartdårar is select b.pnr,b.fnamn,b.enamn,f.regnr,f.tillverkare,f.modell
from bilägare b,fordon f
where f.pnr = b.pnr
and f.hk > 200;
begin
for v_rec in c_fartdårar
loop
insert into fartdåre(pnr,fnamn,enamn,regnr,tillverkare,modell)
values(v_rec.pnr,v_rec.fnamn,v_rec.enamn,v_rec.regnr,v_rec.tillverkare,v_rec.modell);
end loop;
commit;
dbms_output.put_line('Kopieringen klar!');
end;
Anybody got an idea?
