我想在与当前运行的模式和包不同的一个包中调用一个模式中声明的过程
还有一个几乎相关的问题,但我的不同之处在于被调用的过程在另一个模式和包中,而不仅仅是另一个包。
declare
l_hub_msg varchar(1000);
l_query varchar(1000);
begin
-- Call a procedure in the same schema. Problem is not here
l_query := 'pkg_hub.loadFlatTable' ;
execute immediate 'l_query' into l_hub_msg;
if l_hub_msg is not null and length(l_hub_portfolio_msg) > 0 then
-- The following line gives me an PLS-00201: identifier 'PKG_EMAIL_PAGE.SENDMSG' must be declared
PKG_EMAIL_PAGE.SENDMSG('Message', 'FromUser@mycompany.com','ToUser@mycompany.com','ToUser@mycompany.com'
'Content',
'someuser@mycompany.com');
end if;
end;
将此过程视为在模式 SCHEMA1 下运行,而 PKG_EMAIL_PAGE 是存在于模式 SCHEMA2 下的包。
使用 SQL Developer 菜单选项,据说我将 PKG_EMAIL_PAGE.SENDMSG 的 EXECUTE 访问权限授予 SCHEMA2。也就是说,它说它成功了。
虽然我无法让它工作:
GRANT EXECUTE ON PKG_EMAIL_PAGE.SENDMSG to SC_REPORT_NEW;
因为它说
QL Error: ORA-04042: procedure, function, package, or package body does not exist
04042. 00000 - "procedure, function, package, or package body does not exist"
*Cause: Attempt to access a procedure, function, package, or package body
that does not exist.
*Action: Make sure the name is correct.
感谢您的阅读;樵夫