Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2416c38

Browse files
committed
fix validation for test packages defined by another user because PACKAGE_BODY state is hidden in all_objects view
1 parent 49304c3 commit 2416c38

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

source/ut_metadata.pkb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ create or replace package body ut_metadata as
3636
end form_name;
3737

3838
function package_valid(a_owner_name varchar2, a_package_name in varchar2) return boolean as
39-
v_cnt number;
39+
v_prc number;
4040
name varchar2(200);
4141
schema varchar2(200);
4242
part1 varchar2(200);
@@ -51,16 +51,15 @@ create or replace package body ut_metadata as
5151

5252
do_resolve(schema, part1, part2);
5353

54-
select count(*)
55-
into v_cnt
54+
select count(decode(status, 'VALID', 1, null)) / count(*)
55+
into v_prc
5656
from all_objects
5757
where owner = schema
5858
and object_name = part1
59-
and object_type in ('PACKAGE', 'PACKAGE BODY')
60-
and status = 'VALID';
59+
and object_type in ('PACKAGE', 'PACKAGE BODY');
6160

6261
-- expect both package and body to be valid
63-
return v_cnt = 2;
62+
return v_prc = 1;
6463
exception
6564
when others then
6665
return false;

0 commit comments

Comments
 (0)