File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 c_expected_grants constant dbmsoutput_linesarray := dbmsoutput_linesarray(' DBMS_LOCK' ,' DBMS_CRYPTO' );
33
44 l_missing_grants varchar2 (4000 );
5+ l_target_table varchar2 (128 );
6+ l_owner_column varchar2 (128 );
57
68 function get_view(a_dba_view_name varchar2 ) return varchar2 is
79 l_invalid_object_name exception;
@@ -16,16 +18,18 @@ declare
1618 end;
1719
1820begin
21+ l_target_table := get_view(' dba_tab_privs' );
22+ l_owner_column := case when l_target_table like ' dba%' then ' owner' else ' table_schema' end;
1923 execute immediate q' [
2024 select listagg(' - ' ||object_name,CHR(10)) within group(order by object_name)
2125 from (
2226 select column_value as object_name
2327 from table(:l_expected_grants)
2428 minus
2529 select table_name as object_name
26- from ]' || get_view( ' dba_tab_privs ' ) || q' [
30+ from ]' || l_target_table || q' [
2731 where grantee = SYS_CONTEXT(' userenv' ,' current_schema' )
28- and owner = ' SYS' )]'
32+ and ] ' || l_owner_column || q ' [ = ' SYS' )]'
2933 into l_missing_grants using c_expected_grants;
3034 if l_missing_grants is not null then
3135 raise_application_error(
3741 end if;
3842end;
3943/
40-
You can’t perform that action at this time.
0 commit comments