Fix hardcoded owner
This commit is contained in:
parent
eb8499239a
commit
2fbe88c62a
@ -233,6 +233,16 @@ CREATE OR REPLACE PACKAGE app AS
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Return current owner (because APEX dont like using USER)
|
||||||
|
--
|
||||||
|
FUNCTION get_owner (
|
||||||
|
in_app_id apps.app_id%TYPE := NULL
|
||||||
|
)
|
||||||
|
RETURN apex_applications.owner%TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -274,6 +274,25 @@ CREATE OR REPLACE PACKAGE BODY app AS
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION get_owner (
|
||||||
|
in_app_id apps.app_id%TYPE := NULL
|
||||||
|
)
|
||||||
|
RETURN apex_applications.owner%TYPE
|
||||||
|
AS
|
||||||
|
out_owner apex_applications.owner%TYPE;
|
||||||
|
BEGIN
|
||||||
|
SELECT a.owner INTO out_owner
|
||||||
|
FROM apex_applications a
|
||||||
|
WHERE a.application_id = COALESCE(in_app_id, app.get_app_id());
|
||||||
|
--
|
||||||
|
RETURN out_owner;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN NO_DATA_FOUND THEN
|
||||||
|
RETURN app.schema_owner;
|
||||||
|
END;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE create_session
|
PROCEDURE create_session
|
||||||
AS
|
AS
|
||||||
PRAGMA AUTONOMOUS_TRANSACTION;
|
PRAGMA AUTONOMOUS_TRANSACTION;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ FROM (
|
|||||||
LEVEL AS level_
|
LEVEL AS level_
|
||||||
FROM user_dependencies d
|
FROM user_dependencies d
|
||||||
CROSS JOIN x
|
CROSS JOIN x
|
||||||
WHERE d.referenced_owner = 'CORE' -- @TODO: hardcoded user
|
WHERE d.referenced_owner = app.get_owner()
|
||||||
CONNECT BY NOCYCLE PRIOR d.name = d.referenced_name
|
CONNECT BY NOCYCLE PRIOR d.name = d.referenced_name
|
||||||
AND LEVEL <= 3 -- limit depth
|
AND LEVEL <= 3 -- limit depth
|
||||||
START WITH d.referenced_name = x.table_name
|
START WITH d.referenced_name = x.table_name
|
||||||
|
|||||||
@ -31,7 +31,7 @@ WHERE r.query_type_code = 'TABLE'
|
|||||||
SELECT DISTINCT d.name AS view_name
|
SELECT DISTINCT d.name AS view_name
|
||||||
FROM user_dependencies d
|
FROM user_dependencies d
|
||||||
CROSS JOIN x
|
CROSS JOIN x
|
||||||
WHERE d.referenced_owner = 'CORE' -- @TODO: hardcoded schema
|
WHERE d.referenced_owner = app.get_owner()
|
||||||
AND d.type = 'VIEW'
|
AND d.type = 'VIEW'
|
||||||
CONNECT BY NOCYCLE d.referenced_name = PRIOR d.name
|
CONNECT BY NOCYCLE d.referenced_name = PRIOR d.name
|
||||||
AND d.referenced_type = 'VIEW'
|
AND d.referenced_type = 'VIEW'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user