简体   繁体   English

触发器内部错误。 PLS-00201:必须声明标识符“ mySchema.Myfunction”。 甲骨文

[英]Error inside trigger. PLS-00201: identifier 'mySchema.Myfunction' must be declared. Oracle

I wrote trigger on oracle. 我在oracle上编写了触发器。 I have error when i try to invoke function inside trigger: error PLS-00201: identifier 'mySchema.Myfunction' must be declared. 当我尝试在触发器内调用函数时出现错误:错误PLS-00201:必须声明标识符'mySchema.Myfunction'。 Can somoeone show me how should i declare it? somoeone可以告诉我如何宣布吗? Thanks. 谢谢。

create or replace 
trigger myTrigger
 BEFORE INSERT OR UPDATE OF name_of_A ON schema_A.myTable
 FOR EACH ROW
DECLARE
  A                   varchar2(10);
BEGIN
  A := :new.name_of_A;
  IF A IS NOT NULL THEN
    :new.name_of_A := schema_B.Myfunction( A);
  END IF;
END;

Solution: 解:

Added script on schema_a: 在schema_a上添加了脚本:

grant execute on myfunction to schema_a;

Also changed 也改变了

:new.name_of_A := schema_B.Myfunction( A);

Into: 进入:

:new.name_of_A := MYFUNCTION( A);

And it works. 而且有效。 Thanks for help! 感谢帮助!

Connect as schema_b 作为schema_b连接

SQL> conn schema_b/password

Then grant the necessary privilege: 然后授予必要的特权:

SQL> grant execute on myfunction to schema_a;

Now schema_a should be able to compile its triggers. 现在,schema_a应该能够编译其触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM