Linked Questions

Popular Questions

declare
begin
  for i in (select aid ,address from address)
  loop
    for j in (select aid ,address from address )
    loop
      if i.address=j.address then
        if i.aid!=j.aid then
          update employee_add 
          set aid=i.aid 
          where aid=j.aid;
          delete from address 
          where aid=i.aid;
        end if;
      end if; 
    end loop;
  end loop;
end;
/

This code works fine as for loop. After that it shows error :------

*Cause: A foreign key value has no matching primary key value.
*Action: Delete the foreign key or add a matching primary key.

I have tables employee[eid (primary key) ,ename] ,address[aid (primary key),address],and many to many relation tableemployee_add[eid,aid]. Please help! Thank in Advance :)

Related Questions