我有一个工作流程,如下所示。

这个工作流的第一个任务运行一个简单的select * query,下一个任务发送一封电子邮件。他们各自工作得很好。我想要的是将SQL任务的输出作为电子邮件任务的输入,这样它就可以附加到正在发送的电子邮件上。
我尝试在notification的下面字段中手动输入SQL任务的runId,它的工作方式与预期的一样。但是,如何使这个字段从其前身获得动态值而不是硬编码的值呢?

另外,我是否可以将select *的输出作为一个表包含在电子邮件正文中?
更新--1
我能够通过下面的脚本获得前面任务的runId。现在只需要帮助将其包含在邮件正文中,而不是攻击。
:SET &NR# = SYS_ACT_PREV_NR()
:PRINT "RunID of the previous task is &NR#."发布于 2020-12-21 14:08:13
一是;
设置
通过运行以下脚本加载包。
sys/passwordord AS SYSDBA
@$ORACLE_HOME/rdbms/admin/utlmail.sql
@$ORACLE_HOME/rdbms/admin/prvtmail.plb
In addition the SMTP_OUT_SERVER parameter must be set to identify the SMTP server.
CONN sys/password AS SYSDBA
ALTER SYSTEM SET smtp_out_server='smtp.domain.com' SCOPE=SPFILE;-仅在10gR1中需要重新启动实例。
立即关机
启动
我建议您在数据库服务器上使用邮件中继,而不是直接连接到外部邮件服务器。邮件中继配置可以很简单,在SMTP_OUT_SERVER参数中引用"localhost“。连接到外部邮件服务器的任何复杂性都隐藏在邮件中继配置中。
发送电子邮件与配置完成,我们现在可以发送邮件使用发送过程。它接受以下参数。
SENDER : This should be a valid email address.
RECIPIENTS : A comma-separated list of email addresses.
CC : An optional comma-separated list of email addresses.
BCC : An optional comma-separated list of email addresses.
SUBJECT : The subject line for the email.
MESSAGE : The email body.
MIME_TYPE : Set to 'text/plain; charset=us-ascii' by default.
PRIORITY : (1-5) Set to 3 by default.
REPLYTO : Introduced in 11gR2. A valid email address.下面是这个用法的一个例子。
BEGIN
UTL_MAIL.send(sender => 'me@domain.com',
recipients => 'person1@domain.com,person2@domain.com',
cc => 'person3@domain.com',
bcc => 'myboss@domain.com',
subject => 'UTL_MAIL Test',
message => 'If you get this message it worked!');
END;
/发送带附件的电子邮件
该包还支持分别使用VARCHAR2包和SEND_ATTACH_RAW包发送带有原始附件和SEND_ATTACH_VARCHAR2附件的邮件。它们的工作方式类似于发送过程,有一些额外的参数。
附件:附件的内容。这应该是VARCHAR2或RAW,这取决于您调用的过程。
ATT_INLINE : Indicates if the attachment should be readable inline. Default FALSE.
ATT_MIME_TYPE : The default is 'text/plain; charset=us-ascii'.
ATT_FILENAME : The name for the attachment.下面是发送带有文本附件的电子邮件的示例。
BEGIN
UTL_MAIL.send_attach_varchar2 (
sender => 'me@domain.com',
recipients => 'person1@domain.com,person2@domain.com',
cc => 'person3@domain.com',
bcc => 'myboss@domain.com',
subject => 'UTL_MAIL Test',
message => 'If you get this message it worked!',
attachment => 'The is the contents of the attachment.',
att_filename => 'my_attachment.txt'
);
END;/
https://stackoverflow.com/questions/65320460
复制相似问题