首页 > 解决方案 > 甲骨文顶点。是否可以忽略错误处理?

问题描述

如果该过程不起作用,是否可以忽略该过程?
当用户单击我页面上的“创建”按钮时,我有一个发送电子邮件的过程。但问题是出于安全原因,我每天最多可以发送 50 封电子邮件。如果用户超过 50 封电子邮件,此过程将显示错误并停止。所以我无法保存新记录。是否可以忽略此过程并继续保存新记录?

标签: oracle-apexoracle-apex-5oracle-apex-5.1

解决方案


创建一个“当其他人”时忽略任何错误的异常

例如

declare
    l_id number;
begin
l_id := apex_mail.send(
    p_to        => 'fred@flintstone.com',
    p_from      => 'barney@rubble.com',
    p_subj      => 'APEX_MAIL with attachment',
    p_body      => 'Please review the attachment.',
    p_body_html => '<b>Please</b> review the attachment');

for c1 in (select filename, blob_content, mime_type 
    from apex_application_files
    where id in (123,456)) loop

    apex_mail.add_attachment(
        p_mail_id    => l_id,
        p_attachment => c1.blob_content,
        p_filename   => c1.filename,
        p_mime_type  => c1.mime_type);
    end loop;
commit;

exception
    when others 
    then
        rollback;
        null;
end;

推荐阅读