record delete restriction trigger

DELIMITER $$
CREATE TRIGGER trigger_name
BEFORE DELETE
ON table_name
FOR EACH ROW
BEGIN
    if SUBSTRING_INDEX(USER(),'@',1) NOT IN ('root') THEN
        CALL cannot_delete_error;
    END if;
END
$$

Comments

Popular posts from this blog

Error while connecting RDP "an authentication error has occurred the token supplied to the function is invalid".

Windows shared network printer issue in ubuntu 18.04

Rename printer from command line in ubuntu.