i tried my best to have a better title for the question but thats all i could make up. Well i will try to explain it by giving an example. Assume i have: Set x = 100200300; Set y = 10; B Now i want to add y into all first 3 numbers which is “100” then add it into “200” and so on. I was wondering if i can do it with “select left” function inside a loop? Not sure how to apply it tho therefore i am seeking for help here. Help me please. Bless
DELIMITER $$
CREATE PROCEDURE proc(
)
BEGIN
DECLARE counter INT DEFAULT 1;
set @x = '100200300400';
set @y = 10;
WHILE counter <= @x DO
select concat(substring(@x,counter,3) + @y,substring(@x,(counter +3),3) + @y) x;
END WHILE;
END$$
DELIMITER ;