暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

如何在Oracle apex_mail.send过程中作为附件发送sql查询结果。

ASKTOM 2021-04-28
656

问题描述


我有一个需要运行的Oracle sql查询,并且需要将查询返回的数据作为附件发送到邮件。您能否指导我如何使用apex_mail.send过程进行操作。我正在从数据库调用apex_mail。我已经配置了apex mail。我可以调用apex_mail.send发送邮件。但是我不确定如何在apex_mail.add附件中附加oracle sql查询返回的结果。


专家解答

将查询的输出保存到clob变量中,然后将其添加为附件

如:

begin
  select ...
  bulk collect into attach_recs
  from ...
  
  for 1 in 1 .. attach_recs.count loop
    attachment := attachment || attach_recs ( i );
  end loop;

  mail_id := apex_mail.send ...
  apex_mail.add_attachment ( mail_id, attachment, 'filename' );
end;

文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论