我已安排一个shell脚本,该脚本输出以下电子邮件。我想删除使用下面的DUAL表打印的不需要/额外的重复文本,以给我的sql选择输出标题。
我该怎么做?
以下是假脱机sql脚本。脚本执行完成后(/home/oracle/MFS_ALERT/PGW_ALERTS_FRAUDS/PGW_ALERTS.out)文件被添加到电子邮件正文并发送给收件人。
你能指导哪个设置参数命令丢失或者下面哪个是额外的或不需要的?
这是shell脚本文件代码。
sqlplus user/pass@pgwdb @/home/oracle/MFS_ALERT/PGW_ALERTS_FRAUDS/PGW_ALERTS.sql
sleep 5
/bin/mail -s "MFS PGW Fraud Alerts (Day)" -r “khalid.mehmood3@jazz.com.pk” "khalid.mehmood3@jazz.com.pk" < /home/oracle/MFS_ALERT/PGW_ALERTS_FRAUDS/PGW_ALERTS.out
set echo off;
set feedback off ;
set verify off ;
set serveroutput off;
set heading on;
set trimspool on;
set headsep off;
set PAGESIZE 60;
set LINESIZE 400;
SET WRAP OFF;
SET COLSEP ' ';
set numw 20;
SPOOL /home/oracle/MFS_ALERT/PGW_ALERTS_FRAUDS/PGW_ALERTS.out append;
select '====== Transactions with count > 2 from same MSISDN ======' from dual;
SELECT '"'
|| MOBILENUMBER
|| '"' MSISDN,
AMOUNT/100 AMOUNT,
DECODE(TXNTYPEID,'6','MW', '0') TXN_TYPE,
MERCHANTCODE,
COUNT (*) COUNT
FROM TBL_TXN_LOG
WHERE TXNTYPEID ='6'
AND AMOUNT <=10000
AND TXNDATETIME>= SYSDATE -1
AND STATUS ='xxxx'
GROUP BY '"'
|| MOBILENUMBER
|| '"', AMOUNT/100, DECODE(TXNTYPEID,'6','MW', '0'), MERCHANTCODE
HAVING COUNT (*) > 2
UNION ALL
SELECT '"'
|| MOBILENUMBER
|| '"' MSISDN ,
AMOUNT/100 AMOUNT,
DECODE(TXNTYPEID,'164', 'Card', '0') TXN_TYPE,
MERCHANTCODE,
COUNT (*) COUNT
FROM TBL_TXN_LOG
WHERE TXNTYPEID ='164'
AND AMOUNT >=2500000
AND TXNDATETIME>= SYSDATE - 1
AND STATUS ='xxxx'
GROUP BY MOBILENUMBER,
AMOUNT,
DECODE(TXNTYPEID,'164','Card', '0') ,
MERCHANTCODE
HAVING COUNT (*) > 1
;
SPOOL OFF;
SET DEFINE ON
SET SERVEROUTPUT OFF
quit
收件人收到的电子邮件。
-----原始消息-----来自:destination.email@emaildomain.com发送:2017年12月8日星期五下午7:36致: destination.email@emaildomain.com主题:MFS PGW欺诈警报(4 每小时)
***指&#39; ====== TRANSACTIONSWITHAMOUNT&LT; 100FORMW&安培;&GT; 25000 ==&#39;
----------------------------------------------- --------------- ***
======交易金额&lt; MW为100&amp; &GT; 25000 ======
MSISDN AMOUNT TXN_ MERCHANTCODE 计数 ---------------------- -------------------- ---- ---- -------------------------- --------------------&#34; 924008482888&#34; 70兆瓦00342386 1 &#34; 924008345433&#34; 20兆瓦002218387
1
我想删除这些额外的行
&#39; ====== TRANSACTIONSWITHAMOUNT&LT; 100FORMW&安培;&GT; 25000 ==&#39;
答案 0 :(得分:1)
稍微更改您的查询,为您的标题使用别名,然后关闭/开启标题,如下所示:
set heading off
select '====== Transactions with count > 2 from same MSISDN ======' as info from dual;
select '<pre>' from dual;
set heading on
-- rest of your query
set heading off
select '</pre>' from dual;
如果邮件是以HTML格式发送的,那应该可以解决问题。