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.
SELECT APEX_PAGE.GET_URL (
p_page => 1,
p_items => 'P1_X,P1_Y',
p_values => 'somevalue,othervalue' ) f_url_1,
Instead of the intended URL: "f?p=100:1234:12782432712506::::P100_ID:123" target="_blank">Link</a>