Saturday, May 22, 2021

How to Encode/Decode a URL using Oracle PLSQL (UTL_URL.ESCAPE AND UTL_URL.UNESCAPE)

 

 

 

 

 

 

                In this post, we have given an example usage of UTL_URL standard package for encoding or decoding a URL. Hope it helps!!

Custom Wrapper Function:

CREATE OR REPLACE FUNCTION encode_decode_url (p_url IN VARCHAR2, p_action IN VARCHAR2 ) RETURN VARCHAR2 AS BEGIN IF p_url IS NULL THEN RETURN NULL; END IF; IF p_action = 'ENCODE' THEN RETURN utl_url.escape(p_url, TRUE); ELSIF p_action = 'DECODE' THEN RETURN utl_url.unescape(REPLACE(p_url, '+', ' ')); ELSE RETURN 'Error: Invslid Action'; END IF; END encode_decode_url;

Sample Run:

 


0 Responses to “How to Encode/Decode a URL using Oracle PLSQL (UTL_URL.ESCAPE AND UTL_URL.UNESCAPE)”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.