Call gather dbms_stats for the schema in which a procedure is stored

Viewed 19

I have the below procedure in my DB schema ('MYSCHEMA').

CREATE OR REPLACE PROCEDURE my_procedure
    IS
BEGIN
    dbms_output.put_line('Start test');
    dbms_stats.gather_table_stats(user,'TEST');
    dbms_output.put_line('End test');
END my_procedure;

Table TEST does only exist in my schema. Is there any way to run this procedure from other schema and make it work without changing it to:

dbms_stats.gather_table_stats('MYSCHEMA','TEST');

Details of my Oracle DB:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
"CORE   12.1.0.2.0  Production"
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
1 Answers
Related