Just add an ELSE
case which sets the value to its current value:
UPDATE mytable SET MAC =
CASE
WHEN MAC NOT LIKE '%-%'
THEN UPPER(CONCAT(SUBSTR(MAC,1,2),'-', SUBSTR(MAC,3,2),'-', SUBSTR(MAC,5,2),'-', SUBSTR(MAC,7,2),'-', SUBSTR(MAC,9,2),'-', SUBSTR(MAC,11,2)))
/* Else case sets it to its current value to avoid NULL */
ELSE MAC
END;
It's also possible to use a WHERE
clause so rows that should not be updated are not matched in the first place. That is probably the more appropriate action to take in this instance, unless you have other conditions to apply in the CASE
UPDATE mytable
SET MAC = UPPER(CONCAT(SUBSTR(MAC,1,2),'-', SUBSTR(MAC,3,2),'-', SUBSTR(MAC,5,2),'-', SUBSTR(MAC,7,2),'-', SUBSTR(MAC,9,2),'-', SUBSTR(MAC,11,2)))
WHERE MAC NOT LIKE '%-%'