Over a million developers have joined DZone.
Platinum Partner

Urlencode/urldecode As MySQL Stored Functions

· Database Zone

Speed up your development and test cycles with fully automated data delivery, view a 10 minute demo, brought to you in partnership with Delphix.



DELIMITER ;

DROP FUNCTION IF EXISTS multiurldecode;

DELIMITER |

CREATE FUNCTION multiurldecode (s VARCHAR(4096)) RETURNS VARCHAR(4096)
DETERMINISTIC 
CONTAINS SQL 
BEGIN
       DECLARE pr VARCHAR(4096) DEFAULT '';
       IF ISNULL(s) THEN
          RETURN NULL;
       END IF;       
       REPEAT
          SET pr = s;
          SELECT urldecode(s) INTO s;
       UNTIL pr = s END REPEAT;
       RETURN s;
END;

|

DELIMITER ;


The Database Zone is brought to you in partnership with Delphix. Learn how you can easily virtualize and clone your database, read the white paper.

Topics:
mysql

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}