got pls-00201 when I call a package via public synonym in Oracle
Question
I created a package named sf_timer in sys, then I created a public synonym on this:
create or replace public synonym sf_timer for sys.sf_timer;
select * from all_synonyms where synonym_name = 'SF_TIMER';
Then I call this package from another user:
set serveroutput on
declare
i integer;
j integer;
begin
sf_timer.start_timer;
for i in 1..100000
loop
j := j +1;
end loop;
sf_timer.show_elapsed_time('Test 1');
end;
/
Unfortunately I got error below:
Error report:
ORA-06550: line 5, column 3:
PLS-00201: identifier 'SF_TIMER' must be declared
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored
ORA-06550: line 10, column 3:
PLS-00201: identifier 'SF_TIMER' must be declared
ORA-06550: line 10, column 3:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
I can see this public synonym from all_synonyms but I don't know why I cannot call the package in my schema.
Thanks in advance.
La solution
Have you granted permissions?
When running as SYS, do this...
GRANT EXECUTE ON SYS.SF_TIMER TO <user-you're-using>;
As a further note it's generally regarded as bad practise to create objects in the SYS schema :-)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow