Use app alias instead of number

This commit is contained in:
Jan Kvetina 2022-01-30 15:19:10 +01:00
parent 707d225492
commit ad68561886
2 changed files with 15 additions and 4 deletions

View File

@ -29,10 +29,11 @@ CREATE OR REPLACE PACKAGE app AS
*
*/
--
core_alias CONSTANT VARCHAR2(30) := 'CORE';
--
schema_owner CONSTANT VARCHAR2(30) := 'CORE';
schema_apex CONSTANT VARCHAR2(30) := 'APEX_210100';
--
core_app_id CONSTANT sessions.app_id%TYPE := 770; -- for sharing pages between apps
-- code for app exception
app_exception_code CONSTANT PLS_INTEGER := -20000;
@ -124,7 +125,8 @@ CREATE OR REPLACE PACKAGE app AS
-- Return app_id for CORE application
--
FUNCTION get_core_app_id
RETURN sessions.app_id%TYPE;
RETURN sessions.app_id%TYPE
RESULT_CACHE;

View File

@ -46,9 +46,18 @@ CREATE OR REPLACE PACKAGE BODY app AS
FUNCTION get_core_app_id
RETURN sessions.app_id%TYPE
RESULT_CACHE
AS
out_id apex_applications.application_id%TYPE;
BEGIN
RETURN COALESCE(app.core_app_id, 0);
SELECT a.application_id INTO out_id
FROM apex_applications a
WHERE a.alias = app.core_alias;
--
RETURN out_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
app.raise_error('CORE_MISSING');
END;