I have tried your code in Mysql,and the same didn't work ; but instead when I added an extra line it worked, which was resetting the delimiter again Kindly check
END$$
DELIMITER ;
And sorry in case if this also goes wrong..But worked fine for me