Is it possible to ignore a process if that process does not work?
I have a process that sends an email when the user clicks the Create button on my page. But the problem is that I can send up to 50 emails per day for security reasons. If the user exceeds 50 emails, this process displays an error and stops. So I can not save the new record. Is it possible on error to ignore this process and continue to save the new record?
Create an exception "when others" that will ignore any error
for example
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;