Question

I can't find where in the code a query is triggered and was wondering if there is a mysql configuration that will reject that query when it is triggered? For example, in my situation it is UPDATE table SET col1 = NULL, col2 = NULL, col3 = NULL ... PLEASE HELP!!!

Was it helpful?

Solution

As mentioned above, you can use a trigger; just call a non-existent procedure to raise an error when the desired criteria are met.

DELIMITER ;;

CREATE TRIGGER reject_null_table_update BEFORE UPDATE ON table FOR EACH ROW
IF
      NEW.col1 IS NULL
  AND NEW.col2 IS NULL
  AND NEW.col3 IS NULL
  -- etc
THEN
  CALL raise_error();
END IF;;

DELIMITER ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top