If you need to retrieve the current APEX server URL using SQL, there are 3 different functions that can help with that.
For example, if my current page is:
https://example.oracle.com/ords/r/myworkspace/myapp/mypage?session=12345
APEX_PAGE.GET_URL:
SELECT APEX_PAGE.GET_URL FROM DUAL; SQL> /ords/r/myworkspace/myapp/mypage?session=12345
APEX_UTIL.HOST_URL:
SELECT APEX_UTIL.HOST_URL FROM DUAL; SQL> https://example.oracle.com
APEX_MAIL.GET_INSTANCE_URL:
SELECT APEX_MAIL.GET_INSTANCE_URL FROM DUAL; SQL> https://example.oracle.com/ords/r/myworkspace/myapp/
If you want to get this from Javascript, you can simply use the "windows.location" method:
window.location.host: "example.oracle.com" window.location.hostname: "example.oracle.com" window.location.href: "https://example.oracle.com/ords/r/myworkspace/myapp/mypage?session=12345" window.location.origin: "https://example.oracle.com" window.location.pathname: "/ords/r/myworkspace/myapp/mypage" window.location.port: ""