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

Skip to content

Commit 9e4deff

Browse files
committed
add exception hadnler to 'alter session set events' to catch insufficient priviliege error
1 parent 1a5de98 commit 9e4deff

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

examples/RunExampleTestSuiteWithDBMSOutputReporter.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ begin
3131
suite.add_item(testtoexecute);
3232

3333
-- provide a reporter to process results
34-
suite.so_execute(ut_dbms_output_suite_reporter);
34+
suite.do_execute(ut_dbms_output_suite_reporter);
3535
end;
3636
/
3737

source/core/ut_assert_processor.pkb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,31 @@ create or replace package body ut_assert_processor as
7777
end;
7878

7979
procedure set_xml_nls_params is
80+
insuf_privs exception;
81+
pragma exception_init(insuf_privs, -1031);
8082
begin
8183
g_session_params := get_session_parameters();
82-
83-
--execute immediate q'[alter session set events '19119 trace name context forever, level 0x8']';
84+
85+
begin
86+
execute immediate q'[alter session set events '19119 trace name context forever, level 0x8']';
87+
exception
88+
when insuf_privs then NULL;
89+
end;
8490

8591
execute immediate 'alter session set nls_date_format = '''||ut_utils.gc_date_format||'''';
8692
execute immediate 'alter session set nls_timestamp_format = '''||ut_utils.gc_timestamp_format||'''';
8793
execute immediate 'alter session set nls_timestamp_tz_format = '''||ut_utils.gc_timestamp_tz_format||'''';
8894
end;
8995

9096
procedure reset_nls_params is
97+
insuf_privs exception;
98+
pragma exception_init(insuf_privs, -1031);
9199
begin
92-
--execute immediate q'[alter session set events '19119 trace name context off']';
100+
begin
101+
execute immediate q'[alter session set events '19119 trace name context off']';
102+
exception
103+
when insuf_privs then NULL;
104+
end;
93105

94106
if g_session_params is not null then
95107
for i in 1 .. g_session_params.count loop

0 commit comments

Comments
 (0)