RE: Error while altering table to add foreign key

RE: Error while altering table to add foreign key

 

  


You can not create constraint on a table if it already contains some rows
which do not satisfy that.

Either go far no validate or add necessary details to parent table first.
Regards
Nikhil

-----Original Message-----
From: sandeep
[mailto:oracledba-ezmlmshield-x52494088.[Email address protected]
Sent: Wednesday, October 31, 2007 10:29 AM
To: LazyDBA Discussion
Subject: Error while altering table to add foreign key


Hi Everyone,

While altering table to add a foreign key I am following error. Can
someone help me in tracking this error?



SQL> alter table emp add constraint sandy foreign key(id) references
loc(id);

alter table emp add constraint sandy foreign key(id) references loc(id)

*

ERROR at line 1:

ORA-02298: cannot validate (PMR.SANDY) - parent keys not found



Br,

Sandeep




The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not
the intended recipient, you should not disseminate, distribute or copy this
e-mail. Please notify the sender immediately and destroy all copies of this
message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus transmitted
by this email.

www.wipro.com


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

Oracle LazyDBA home page