48.77 HOST_URL Function

This function returns the URL to the Oracle APEX instance, depending on the option passed.

Syntax

APEX_UTIL.HOST_URL (
    p_option    IN VARCHAR2 DEFAULT NULL )
RETURN VARCHAR2;

Parameters

Table 48-66 HOST_URL Parameters

Parameter Description
p_option

Specifies the parts of the URL to include.

Possible values forp_option include:

  • NULL - Return URL up to port number. For example:
    http://myserver.com:7778
  • SCRIPT - Return URL to include script name. For example:

    For example (Friendly URL enabled):

    https://myserver.com:7778/pls/apex/{workspace}/r/{application}

    For example (Friendly URL disabled)

    https://myserver.com:7778/pls/apex/
  • APEX_PATH - Return URL to include the APEX path. For example:
    https://myserver.com:7778/pls/apex/
  • IMGPRE - Return URL to include image prefix. For example:
    https://myserver.com:7778/i/

Example

The following example returns the URL to the current APEX instance including the script name.

declare
    l_host_url      varchar2(4000);
    l_url           varchar2(4000);
    l_application   varchar2(30) := 'f?p=100:1';
    l_email_body    varchar2(32000);
begin
    l_host_url := apex_util.host_url('SCRIPT');
    l_url := l_host_url||l_application;
    l_email_body := 'The URL to the application is: '||l_url;
end;