URL_ENCODE Function

The following special characters are encoded as follows:

 Special       After 
Characters    Encoding
    %          %25
    +          %2B
  space         +
    .          %2E
    *          %2A
    ?          %3F
    \          %5C
    /          %2F
    >          %3E
    <          %3C
    }          %7B
    {          %7D
    ~          %7E
    [          %5B
    ]          %5D
    '          %60
    ;          %3B
    ?          %3F
    @          %40
    &          %26
    #          %23
    |          %7C
    ^          %5E
    :          %3A
    =          %3D
    $          %24

Syntax

APEX_UTIL.URL_ENCODE (
    p_url   IN    VARCHAR2) 
    RETURN VARCHAR2;

Parameters

Table 35-125 URL_ENCODE Parameters

Parameter Description

p_url

The string to be encoded.

Example

The following example shows how to use the URL_ENCODE function.

DECLARE
    l_url  VARCHAR2(255);
BEGIN
    l_url := APEX_UTIL.URL_ENCODE('http://www.myurl.com?id=1&cat=foo');
END;

In this example, the following URL:

http://www.myurl.com?id=1&cat=foo

Would be returned as:

http%3A%2F%2Fwww%2Emyurl%2Ecom%3Fid%3D1%26cat%3Dfoo