How to reject delete statement in before delete trigger?

一笑奈何 提交于 2019-12-02 09:44:54

You could create a table that uses a foreign key constrait referencing your ID column (provided that is the primary key of your table). The insert a row into that "child" table that references ID = 0 and remove all update/delete privileges for your user from that table.

Now if someone tries to delete the row with ID = 0 in the "parent" table that will fail due to an existing child row in the other table.

esaj

Look here, same thing but with an insert-trigger: How to abort INSERT operation in MySql trigger?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!