Skip to content

Instantly share code, notes, and snippets.

@faryne
Created July 24, 2015 06:12
Show Gist options
  • Save faryne/04bd37434c835841cbc4 to your computer and use it in GitHub Desktop.
Save faryne/04bd37434c835841cbc4 to your computer and use it in GitHub Desktop.
CREATE TRIGGER insert_enc BEFORE INSERT ON dmhy_lists
FOR EACH ROW
BEGIN
IF UPPER(NEW.title) REGEXP '(繁|BIG5)' THEN
SET NEW.enc = '1';
ELSEIF UPPER(NEW.title) REGEXP '(简|GB)' THEN
SET NEW.enc = '2';
END IF;
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment