ORA-01031: insufficient privileges
Situation 1 :
SQL> ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 12';
Session altered.
works fine.
Situation 2 :
SQL> begin
2 execute immediate 'ALTER SESSION SET EVENTS ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12''';
3 end;
4 /
PL/SQL procedure successfully completed.
works fine.
Situation 3 :
SQL> CREATE OR REPLACE Package GSY_general_4 as
2 procedure trace_on;
3 End GSY_general_4;
4 /
Package created.
SQL> CREATE OR REPLACE Package body GSY_general_4 as
2
3 procedure trace_on is
4 begin
5 execute immediate 'ALTER SESSION SET EVENTS ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12''';
6 end trace_on;
7
8 End GSY_general_4;
9 /
Package body created.
SQL> execute gsy_general_4.trace_on;
BEGIN gsy_general_4.trace_on; END;
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "DEMO40.GSY_GENERAL_4", line 5
ORA-06512: at line 1
Gives me that error
Question: Why?