我的Oracle中有两个表,一个plant_asset表,一个plantasset_type表,我现在想在plant_asset中添加一列为typeid作为外键,代码如下:
alter table plant_asset add constraint fk_plantAsset_plantAssetType foreign key(typeid) references plantasset_type(id) on delete cascade;  
其中fk_plantAsset_plantAssetType 为外键名,typeid为plant_asset中的一列,而id是plantasset_type中的一列,但是代码错误,请大家帮忙,谢谢!!!错误如下:
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在线急等!!