728x90

CREATE FUNCTION reverse(inputstring VARCHAR(100))

RETURNS VARCHAR(100)

SPECIFIC reverse

BEGIN ATOMIC

DECLARE strlength INTEGER;

DECLARE returnstring VARCHAR(100);

SET strlength =  LENGTH(inputstring);

SET returnstring = '';

WHILE strlength > 0

        DO

                SET returnstring = returnstring || SUBSTR(inputstring,strlength,1);

                SET strlength = strlength - 1;

END WHILE;


RETURN returnstring;

END@


728x90

+ Recent posts