首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

oracle中添加外键时发生异常

2012-03-03 
oracle中添加外键时发生错误Error starting at line 1 in command:alter table PLANT_ASSET add constrain

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为主键吧?自己看下

热点排行