我的任务是从 a 中删除条目,parent table这意味着我需要删除child table. 我需要在 a 中执行此操作,并且procedure基于primary key. parent table截至目前,我只是对input parameters我需要什么感到困惑。这是我到目前为止所拥有的:
procedure sps_delete_patientmedrecs_det (
p_parentPK_in in parent_table.parentPK%type,
p_err_code_out out number,
p_err_msg_out out varchar2)
delete from child_table
where child_table.childFK = p_parentPK_in;
delete from parent_table
where parent_table.parent.parentPK = p_parentPK_in;
end;
截至目前,我认为这行不通,因为我认为他们不procedure知道它child foreign key是什么。我想过做一个select声明,但后来我很困惑,input paremeters因为我只得到 p_parentPK_in。任何帮助表示赞赏,并提前感谢您。
也作为脚注,DELETE CASCADE不在图片中。