473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Execution details in email notification

Hi All,

I am using the following function to send execution details of the process-flow. This process-flow is having 20 mappings. This is working fine.


The cIient requirment is to pass email-IDs from a back-end table(sam_mail_notification) with columns(smtp, port, from_address and to_address), right now the function is working on static(constant) values, Can I get the modified function from you.

--initialize variables here

-- main body
Expand|Select|Wrap|Line Numbers
  1. retval number := 0; --default 
  2.  
  3. mailhost CONSTANT VARCHAR2(30) := 'EMAILSERVER';
  4.  
  5. crlf CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
  6.  
  7. pSender VARCHAR2(30) := 'abc@dub.ae';
  8.  
  9. pRecipient VARCHAR2(30) := 'abc@dub.ae';
  10.  
  11. pSubject VARCHAR2(100) := 'Process REsults for: '||to_char(sysdate,'dd/mm/yyyy');
  12.  
  13. mesg VARCHAR2(32767);
  14.  
  15. mail_conn utl_smtp.connection;
  16.  
  17. cursor getResults is
  18.  
  19. select AREA.OBJECT_NAME,
  20. AREA.CREATED_ON,
  21. AREA.UPDATED_ON,
  22. aramr.ELAPSE_TIME,
  23. NUMBER_RECORDS_SELECTED,
  24. NUMBER_RECORDS_INSERTED,
  25. NUMBER_RECORDS_UPDATED,
  26. NUMBER_ERRORS,
  27. AREA.RETURN_RESULT,
  28. AREA.EXECUTION_AUDIT_STATUS,
  29. MESSAGE_SEVERITY,
  30. MESSAGE_TEXT
  31. from
  32. all_Rt_audit_executions area,
  33. all_Rt_audit_map_runs aramr,
  34. all_rt_audit_exec_messages err
  35. where AREA.execution_audit_id = ARAMR.execution_audit_id(+) AND
  36. AREA.execution_audit_id = err.execution_audit_id(+)
  37. and
  38. trunc(area.created_on) = trunc(sysdate)
  39. AND AREA.OBJECT_NAME IS NOT NULL AND AREA.TASK_TYPE!='ProcessFlow'
  40. AND area.top_level_execution_audit_id =(select max(top_level_execution_audit_id)from all_Rt_audit_executions
  41. where execution_name = (select execution_name from all_Rt_audit_executions where task_type ='ProcessFlow' and top_level_execution_audit_id =
  42. (select max(top_level_execution_audit_id) from all_Rt_audit_executions)));
  43.  
  44. BEGIN 
  45.  
  46. mail_conn := utl_smtp.open_connection(mailhost, 25); 
  47.  
  48. mesg := 'Date: ' ||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf || 
  49.  
  50. 'From: <'|| pSender ||'>' || crlf || 
  51.  
  52. 'Subject: '|| pSubject || crlf || 
  53.  
  54. 'To: '||pRecipient || crlf || '' || crlf || 
  55.  
  56. 'MAPNAME START_TIME END_TIME ELAPSED SELECTED INSERTED UPDATED ERRORS RESULT AUDIT_STSTUS SEVERITY MESSAGE_TEXT'||crlf ; 
  57.  
  58. for rec in getResults 
  59.  
  60. loop 
  61.  
  62. mesg:=mesg || rpad(rec.OBJECT_NAME,30)|| 
  63.  
  64. rpad(to_char(rec.CREATED_ON, 'HH24:MI:SS DD-MON-YY'),20)|| 
  65.  
  66. rpad(to_char(rec.UPDATED_ON, 'HH24:MI:SS DD-MON-YY'),24)|| 
  67.  
  68. rpad(to_char(rec.ELAPSE_TIME),7)|| 
  69.  
  70. rpad(to_char(rec.NUMBER_RECORDS_SELECTED),8)|| 
  71.  
  72. rpad(to_char(rec.NUMBER_RECORDS_INSERTED),10)|| 
  73.  
  74. rpad(to_char(rec.NUMBER_RECORDS_UPDATED),10)|| 
  75.  
  76. rpad(to_char(rec.NUMBER_ERRORS),5)|| 
  77.  
  78. rpad(to_char(rec.RETURN_RESULT),8)|| 
  79.  
  80. rpad(to_char(rec.EXECUTION_AUDIT_STATUS),10)|| 
  81.  
  82. rpad(to_char(rec.MESSAGE_SEVERITY),10)|| 
  83.  
  84. rpad(to_char(rec.MESSAGE_TEXT),200)||crlf; 
  85.  
  86. end loop; 
  87.  
  88. utl_smtp.helo(mail_conn, mailhost); 
  89.  
  90. utl_smtp.mail(mail_conn, pSender); 
  91.  
  92. utl_smtp.rcpt(mail_conn, pRecipient); 
  93.  
  94. utl_smtp.data(mail_conn, mesg); 
  95.  
  96. utl_smtp.quit(mail_conn); 
  97.  
  98. return retval;
  99.  
  100. EXCEPTION 
  101.  
  102. WHEN OTHERS THEN 
  103.  
  104. return 1; 
  105. END; 

Regards,
Dec 23 '07 #1
2 1710
amitpatel66
2,367 Expert 2GB
Yes, of course you can change your function to accept input parameters as you require. Why dont you try changeing your function by including variables and posting back in case if you face any error!!
Dec 24 '07 #2
Yes, of course you can change your function to accept input parameters as you require. Why dont you try changeing your function by including variables and posting back in case if you face any error!!



Hi Amit,

But the values should come from database table only.

Regards.
Dec 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Oliver | last post by:
I've been looking for information regarding this and all i can gather is posters informing posties to use $< and $>. However, i can't seem to find an example on how to apply that. Information...
27
by: vishnu mahendra | last post by:
cah you please tell me how to find the execution time of a program in c. thank you in advance, vishnu
2
by: Ravi J | last post by:
I am trying to load Microsoft Word and create a document in ASP.NET (C#). But the call to application creation 'Word._Application app = new Word.ApplicationClass();' takes quit a bit of time, and...
2
by: Bassel Tabbara | last post by:
I wrote the following code: oApp = new Outlook.Application(); oApp = new Outlook.Application(); oNameSpace= oApp.GetNamespace("MAPI"); oNameSpace.Logon(null,null,true,true); //gets defaultfolder...
8
by: NickName | last post by:
Hi, Say, you have two inter-dependent packages of pA and pB. With the successful execution of pA you would proceed to execute pB. And since they would perform some repeatitive tasks on regular...
23
by: roman | last post by:
Hi, I would like to have two actions for one event. But I want the second action to trigger when the first one action completes. Is it possible to do this in javascript? I'm using the onclick...
2
by: Kosmos | last post by:
Alright so I've got this Outlook code written in VBA in Access. The first part, which works, records information about appointment times based on the required days before notification of certain...
3
by: steven.rojas | last post by:
I have a chat application based on PHP and Flash, I know that is necessary execute the socket server script from the console (#!/usr/ local/bin/php -q), but my problem is that I don't have SSH...
0
by: Ethender | last post by:
I am using the following function to send execution details of the process-flow. This process-flow is having 20 mappings. This is working fine. The cIient requirment is to pass email-IDs from a...
0
by: vsrprasad16 | last post by:
Hi All, I am implementing a notification form similar to outlook email notification. my application call this notification form from a dll. this dll includes a form class and this dll has some...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.