I have a database where the customer wants run an DELETE statement. But on database side, the record should be just hidden instead of deleted.
Can i use a BEFORE DELETE TRIGGER to change the visiblity flag to false instead of deleting the record?
I think the only way to do this in MySQL (as Alex Monthy hinted, is that really where this logic belongs?) is to use an after delete trigger that re-inserts the record with the
visibilityflag set to false:You can abort the delete operation from a before trigger (just make the trigger raise an error, e.g. call an non-existent procedure), but that won’t enable you to update the
visibilityflag as desired.