Skip to content

Instantly share code, notes, and snippets.

@juntalis
Created November 10, 2014 00:15
Show Gist options
  • Save juntalis/0ed44b5c33fdb17ffd59 to your computer and use it in GitHub Desktop.
Save juntalis/0ed44b5c33fdb17ffd59 to your computer and use it in GitHub Desktop.
BEGIN
DECLARE i INT DEFAULT 1;
DECLARE loc INT;
SET loc = LOCATE(CONCAT(word,' '), str, 2);
IF loc > 1 THEN
WHILE i <= LENGTH (str) AND loc <> 0 DO
SET str = INSERT(str,loc,LENGTH(word),LCASE(word));
SET i = loc+LENGTH(word);
SET loc = LOCATE(CONCAT(word,' '), str, i);
END WHILE;
END IF;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment