oralce设置主表记录删除,子表关联记录也删除的脚本

alter table d add constraint fk_d foreign key ( column_f ) references e ( column_p ) on delete cascade ;

d 是子表,e是主表 column_f是子表中外建对应的列,column_p是主表中的主建列

alter table d add constraint fk_d foreign key ( column_f ) references e ( column_p ) on delete set null ;

删除主表记录时,将子表的相关联字段改为null 

你可能感兴趣的:(脚本,F#)