Note: Since Apex 20.1, the apex_page.get_url function DOES include the p_plain_url parameter, as in my new function detailed below. Somebody at Oracle may have read this page a while back... :-)
So this information is still valid, but only up till Apex 19.2.
Newer versions of Apex provide two functions to generate URLs:
The oracle documentation gives this example:
This query uses APEX_PAGE.GET_URL and its alternative APEX_UTIL.PREPARE_URL to produce two identical URLs.
Instead of the intended URL: "f?p=100:1234:12782432712506::NO::P100_ID:123" target="_blank">Link</a>