I am new to MySQL user functions, my requirement is:
a. take a varchar (name) as input,
b. split it into char by char
c. Loop for each char from name str: Do something.
DELIMITER //
CREATE FUNCTION te1(name VARCHAR(64))
RETURNS VARCHAR DETERMINISTIC
BEGIN
//Here I want to split name, and store it in some char[], so that I can iterate through it.
//Iterate through characters
END//
DELIMITER ;
googled, but could not find a way to split a String into char[] in MySQL. In my case there is no delimiter, should split each char
Try this solution:
Note: i'm using
TRIM()in my example but obviously it's not mandatory.