【问题标题】:Send concurrent program XLS output as attachment through mail to target Email ID通过邮件将并发程序 XLS 输出作为附件发送到目标电子邮件 ID
【发布时间】:2018-06-22 05:49:48
【问题描述】:

我在 IBM AIX 5.3 上使用 Oracle EBS R12.1.3

最近我有一个需求,需要通过邮件将并发程序的输出作为附件发送。输出为 .XLS 格式。

以下代码适用于将 XLS 格式的并发程序输出文件发送到所需的电子邮件 ID。

echo "starting the program"
echo "################################"
echo "Current Child Request ID :"$4
REQ_ID=$4
echo $REQ_ID
echo "Do you want the output through auto-generated email:" $5

if [ $5 == 'Y' ]
then
echo "As per your request generating email containing XLS output as attachment for the Concurrent request $4"
YEAH_FILE=
sqlplus -s <DB_Schema_Name>/<Schema_Password>@<Instance_Name> << EOF
set linesize 300;
set pagesize 0;
set echo off;
set serveroutput off;
set sqlblank off;
set feedback off;
set heading off;
set wrap off;
col "REQ" format 9999999;
select '$APPLCSF/out/*' || REQUEST_ID ||'*.xls ' from FND_CONC_REQ_SUMMARY_V where REQUEST_ID ='$REQ_ID'; spool off EOF

#Get the email ID
SEND_MAIL_ID = 'echo <Email_ID>'

cat <<'EOF' - $YEAH_FILE | /usr/sbin/sendmail $SEND_MAIL_ID
Subject: Email with XLS output
Content-Type: application/vnd.ms-excel
MIME-Version: 1.0
Content-Disposition: attachment
EOF

else [ $5 == 'N' ]
echo "As per your request the Email won't trigger for the Concurrent request $4"
fi

exit 0;

【问题讨论】:

  • 有什么问题,或者没有,你只想打扰我们?

标签: database shell email-attachments host oracle-ebs


【解决方案1】:

这里没有真正的问题。

但是,如果您正在寻找有关脚本的反馈,请注意您在命令行上使用密码是不安全的 - 可以在进程中查看它们。您应该通过 STDIN 传递它们 - 这可以通过管道完成:https://asktom.oracle.com/pls/asktom/f%3Fp%3D100:11:0::::P11_QUESTION_ID:142212348066

或在 SQL*Plus 会话中: Passing variable user,pass,sid in sqlplus comman

【讨论】:

    【解决方案2】:

    以下代码适用于将 XLS 格式的并发程序输出文件发送到所需的电子邮件 ID。

    echo "starting the program"
    echo "################################"
    echo "Current Child Request ID :"$4
    REQ_ID=$4
    echo $REQ_ID
    echo "Do you want the output through auto-generated email:" $5

    if [ $5 == 'Y' ]
    then
    echo "As per your request generating email containing XLS output as attachment for the Concurrent request $4"
    YEAH_FILE=
    sqlplus -s <DB_Schema_Name>/<Schema_Password>@<Instance_Name> << EOF
    set linesize 300;
    set pagesize 0;
    set echo off;
    set serveroutput off;
    set sqlblank off;
    set feedback off;
    set heading off;
    set wrap off;
    col "REQ" format 9999999;
    select '$APPLCSF/out/*' || REQUEST_ID ||'*.xls ' from FND_CONC_REQ_SUMMARY_V where REQUEST_ID ='$REQ_ID'; spool off EOF

    #Get the email ID
    SEND_MAIL_ID = 'echo <Email_ID>'

    cat <<'EOF' - $YEAH_FILE | /usr/sbin/sendmail $SEND_MAIL_ID
    Subject: Email with XLS output
    Content-Type: application/vnd.ms-excel
    MIME-Version: 1.0
    Content-Disposition: attachment
    EOF

    else [ $5 == 'N' ]
    echo "As per your request the Email won't trigger for the Concurrent request $4"
    fi

    exit 0;

    【讨论】:

      猜你喜欢
      • 2019-01-22
      • 1970-01-01
      • 2011-07-21
      • 2014-03-20
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 2011-04-20
      • 2011-09-23
      相关资源
      最近更新 更多