2012-10-10 51 views
0
通過公共同義詞叫包

我創建了一個名爲sf_timer在sys包,然後我創建了這個公共同義詞:了PLS-00201,當我在甲骨文

create or replace public synonym sf_timer for sys.sf_timer; 
select * from all_synonyms where synonym_name = 'SF_TIMER'; 

然後我把這個包從另一個用戶:

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; 
/

不幸的是我得到了以下錯誤:

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. 

我可以看到這個all_synonyms公共同義詞但我不知道爲什麼我不能在我的模式中調用該包。

在此先感謝。

+0

大。您可以通過點擊答案旁邊的勾號將答案標記爲正確。 – cagcowboy

回答

1

您是否授予了權限?

當作爲SYS運行,做到這一點...

GRANT EXECUTE ON SYS.SF_TIMER TO <user-you're-using>; 

作爲再一注意它一般被認爲是不好的做法,建立在SYS模式對象:-)

+0

是的,它的工作原理!謝謝你的幫助。 – Jerry