当前位置: 代码迷 >> J2EE >> oracle中添加外键时发生异常
  详细解决方案

oracle中添加外键时发生异常

热度:266   发布时间:2016-04-22 02:33:27.0
oracle中添加外键时发生错误
Error starting at line 1 in command:
alter table PLANT_ASSET add constraint fk_plantAsset_plantAssetType foreign key(TYPEID) references PLANTASSET_TYPE(ID) on delete cascade
Error report:
SQL Error: ORA-02298: 无法验证 (USER_BASK_SYS.FK_PLANTASSET_PLANTASSETTYPE) - 未找到父项关键字
02298. 00000 - "cannot validate (%s.%s) - parent keys not found"
*Cause: an alter table validating constraint failed because the table has
  child records.
*Action: Obvious

------解决方案--------------------
你把主键设成外键了!换一个弄成外键就成了,现在你的typeid为主键吧?自己看下
  相关解决方案