APEX的一种安全机制,在APEX之外运行其数据库内部的存储过程需要在过程中
调用APEX的API命令,否则就会报错
ORA-20001: This procedure must be invoked from within an application session.
要求必须从一个应用程序会话中调用,
要运行从SQL Developer或计划任务调度使用数据库,需要手动设置在执行Apex的API或访问数据的情况下安全组的命令
APEX中发送邮件:
begin
apex_mail.send(
p_to => 'to_user@their_company.com', -- change email address
p_from => 'your_email@company.com', -- change to your email address
p_body => 'Main email text goes here',
p_subj => 'APEX_MAIL Package - Plain Text message'
);
end;
首先获取工作区编号:
select workspace, schemas, workspace_id
from apex_workspaces;
然后修改为
begin
wwv_flow_api.set_security_group_id(workspace_id);
apex_mail.send(
p_to => 'to_user@their_company.com', -- change email address
p_from => 'your_email@company.com', -- change to your email address
p_body => 'Main email text goes here',
p_subj => 'APEX_MAIL Package - Plain Text message'
);
end;
apex中无法通过外部sql调用数据库过程(apex安全机制)
最新推荐文章于 2024-07-16 17:00:04 发布