Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下查询不起作用。请告诉我这里出了什么问题。它给出错误报告:SQL 错误:ORA-00933:SQL 命令未正确结束 00933。00000 -“SQL 命令未正确结束”。我试图一次从两个表中删除数据。
delete t1,t2 from x t1 inner join y t2 on t1.id=t2.id where t1.id in (SELECT object_id FROM z WHERE name = 'YourName');
在单个查询中一次从两个表中删除数据???不可能。
我猜你只是不能同时从两个表中删除数据。您必须使用 2 个查询。使用事务可能有助于模型的一致性。
如果 t1 和 t2 是内连接的,那么您的选择是进行引用ON DELETE CASCADE,因此您只需删除父行即可自动删除所有子行。
ON DELETE CASCADE
rgds。