我有一个包含三个表的 DB2 数据库:   locations, items, movement_history. 该items表有一个外键location_id, into locations。该movement_history表有一个外键 , item_idintoitems和两个外键, location_id_beforeand location_id_after, into locations。
location如果没有行items或引用它,我想删除movement_history它。如果该location行在某处被引用,我只想更新它以标记为已删除。有没有办法在一个声明中做到这一点?最好的方法是什么?