I have a MySQL 5.0 server. I want to build a BEFORE DELETE TRIGGER that will ignore a delete statement if a condition exists.
I do not need to return a message if the DELETE fails the condition.
All the examples I have found use SIGNAL SQLSTATE to throw an error. Sound great, only MySQL 5.0 does not support SIGNAL SQLSTATE.
DELIMITER $$
CREATE DEFINER=`myname`@`%`
TRIGGER `tbtimecard_BDEL`
BEFORE DELETE ON `tbtimecard`
FOR EACH ROW
BEGIN
if date(old.dt_of_entry) <> curdate() then
delete from `rhi_sap`.`tbtimecard` where id = 0;
END IF;
END$$