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