Send an email when the package has failed or has ended?

I want to run a package from a main precedure, I know the precedure will send an e-mail if the package failed, how can I do to send an e-mail to inform the user that the package ended up successful?
  
PROCEDURE suppl_load_main
   IS
      /**********************************************************************************
      Modification History
      08/11/2009 Creator
      This is the precedure that will execute the all package, there are not parameters,
      the package just need to be executed from this precedure.
      Changes:
       .
      **************************************************************************************/
      p_applicant_main_err_code   VARCHAR2 (2000);
      p_main_err_code             NUMBER;
      p_ora_err_msg               VARCHAR2 (2000);
      p_insert_err_code           VARCHAR2 (2000);
      p_ora_err_code              VARCHAR2 (2000);
      p_srtpers_err_code          VARCHAR2 (2000);
      p_gurmail_err_code          VARCHAR2 (2000);
      v_out_path                  VARCHAR2 (40)                 := 'MIDD_LOG';
      v_out_file                  VARCHAR2 (40)
         := 'commonapp_supl_load_pkg' || '_'
            || TO_CHAR (SYSDATE, 'YYYYMMDDHH');
      v_file_handle               UTL_FILE.file_type;
      p_refresh_err_code          VARCHAR2 (20000);
      v_email                     saturn_midd.mail.email_con;
      v_mailto                    saturn_midd.mail.email_address;
      v_mailfrom                  saturn_midd.mail.email_address;
      v_mailsubject               VARCHAR2 (65)                  := '';
      v_mailmessage               VARCHAR2 (32000)               := '';
      v_database_name             VARCHAR2 (10);
   BEGIN
      SELECT ora_database_name
        INTO v_database_name
        FROM DUAL;

      v_database_name :=
              SUBSTR (ora_database_name, 1, INSTR (ora_database_name, '.') - 1);
      -- isolate instance name
      v_file_handle := UTL_FILE.fopen (v_out_path, v_out_file, 'w');
      UTL_FILE.put_line (v_file_handle, v_database_name);
      UTL_FILE.put_line (v_file_handle,
                         ' ' || TO_CHAR (SYSDATE, 'DD-MON-YYYY HH:MI:SS')
                        );
      UTL_FILE.put_line (v_file_handle, 'Starting the stuu_MISS_LOAD_main...');
      srtiden_insert (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
      srtaddr_insert (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
      srtpers_insert (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
      upd_srtpers_day_mon_yr (p_srtpers_err_code,
                              p_ora_err_code,
                              p_ora_err_msg
                             );
      srttele_home (p_insert_err_code, p_ora_err_code, p_ora_err_msg);
      appl_gurmail_insert (p_gurmail_err_code, p_ora_err_code, p_ora_err_msg);
      p_main_err_code := '0';
      UTL_FILE.put_line (v_file_handle,
                         CHR (10) || 'All procedures ended successfully.'
                        );
      UTL_FILE.fflush (v_file_handle);
      UTL_FILE.fclose_all;

      IF p_applicant_main_err_code = 0
      THEN
         UTL_FILE.fremove (v_out_path, v_out_file);
      END IF;
   EXCEPTION
      WHEN OTHERS
      THEN
         p_applicant_main_err_code := '1';
         p_ora_err_msg := SUBSTR (SQLERRM, 1, 2000);
         p_ora_err_code := SQLCODE;
         v_mailto.email := '[email protected]';
         v_mailfrom.email := '[email protected]';
         v_mailsubject := v_database_name || ': commonapp_supl_load_pkg';
         saturn_midd.mail.MESSAGE
                                 (v_email,
                                  v_mailto,
                                  v_mailfrom,
                                  v_mailsubject,
                                     v_database_name
                                  || ': *commonapp_supl_load_pkg* '
                                  || CHR (10)
                                  || 'Output log is on the server MIDD_LOG: '
                                  || v_out_path
                                  || '/'
                                  || v_out_file
                                 );
         saturn_midd.mail.message_end (v_email);
  END suppl_load_main;

anywhere between
end if;
and
exception

;)

------------
Sybrand Bakker
Senior Oracle DBA

Tags: Database

Similar Questions

  • I need to send an email when the recipient opens the PDF with a password, can someone help me and show me how to do

    Hello, I am trying to send an email when the recipient opens the PDF with a password, can someone show me how to do

    Hi Line,

    Password protect a PDF file, you must use Acrobat. If you do not have Acrobat, you can try it free for 30 days. See www.adobe.com/products/acrobat.html for more information.

    In Acrobat, choose file > properties when the document is open, and then click the Security tab allows you to set up a password.

    Please let us know how it goes.

    Best,

    Sara

  • Send an email when the report is updating

    Hi all

    Is it possible, in its responses, to send an email automatically when a report is be updated?

    Thanks in advance,
    LAU

    You can do it several ways, as you said using the ibot also conditional. You should have the flag or flag in your database indicating that the ETL burden was made. Then based on a conditional query run an ibot. But the thing is after completing this ibot you will need to lower the flag.

    Another easy way is to create a report that runs ibot, make sure that you have verified that the Oracle BI Server Cache feed checkbox save the ibot. At the end of the ETL, run a command that performs the work of ibot for you. There is a mode application command in Oracle BI called SASchInvoke.exe. This application will run the ibot for you.

    Here's the blog that explains more in this regard.

    http://oraclebizint.WordPress.com/2008/03/06/Oracle-BI-EE-101332-integrating-schedulerdelivers-into-other-applications/

    -Madan

  • How to send an email to the owner in 6.1 creating the VM

    Y at - it an easy way to havevCACautomaticallysendanemailto of the applicant (owner) emailaddresss?

    Thank you

    -MattG

    There are several discussions on notifications by e-mail to vCAC. 2 options are to enable notification vCAC scenarios and setting of the outgoing e-mail server (can be found in the documentation vCAC) or vCO allows you to send an email when the machine is ready. Send a personalized Notification

    There is no real good answer right now. Hope this is resolved quickly.

  • An email received, how can I configure my email to receive a notification when the recipient has read the email?

    How can I configure my email to receive a notification when the recipient has read the email?

    Based on your e-mail program, a read receipt can be ignored by the recipient and some servers will block any reception

    Basically there is no process by which a receipt can be confirmed or that the recipient has read the mail - except by asking them directly

  • How to send an email with the link that has the user id?

    Hello everyone, I'm trying to send an email with the link that includes the user id. After users click the link, they should be able to see the form with their information that has been previously fulfilled. So my question is after I have send email how and what is the best way to get information and show it to the user. What should be separate page with the cfquery limited on the id user or something else? If anyone has an idea of what is the best way to do it please let me know. I already have my code who send e-mails.

    You save all the fields submitted initially to a database?  If so, run a query and then convert them to the form field, query values. I don't know what looks like your data (or database), but a simplified version might look like this.

    SELECT FirstName

    OF SavedFormTable

    WHERE ID =

  • Send an email with the password

    I am new to this, but I really tried to learn about this, please bear with me while I hope I have my question in a way that you can understand what I'm asking. What I'm trying to do, is to build a simple page with a form, a box and a button. In the text box, the user will provide its name and hitting the button send the user will be sent a password for access to his email address that they provided with when they registered with our company. Sounds simple right? Well, for me it has become a headache.

    I work with an asp code and using CDOSYS to send my application. I enclose the code in order to review and see if you have solutions.



    < %@LANGUAGE="VBSCRIPT"% >
    <!-file = "Connections/register.asp #include" - > "
    < %
    Dim rsgetpassword__MMColParam
    rsgetpassword__MMColParam = '1 '.
    If (Request.Form ("txtusername") <>"") then
    rsgetpassword__MMColParam = Request.Form ("txtusername")
    End If
    % >
    < %
    Dim rsgetpassword
    Dim rsgetpassword_numRows

    Set rsgetpassword = Server.CreateObject ("ADODB. Recordset')
    rsgetpassword. ActiveConnection = MM_register_STRING
    rsgetpassword. Source = "SELECT password, Email FROM dbo. ' Username WHERE UserName = ' ' + replace (rsgetpassword__MMColParam, "'", "" ") +" ' ORDER BY UserName ASC ".
    rsgetpassword. CursorType = 0
    rsgetpassword. CursorLocation = 2
    rsgetpassword. LockType = 1
    rsgetpassword. Open()

    rsgetpassword_numRows = 0
    % >
    < %
    If rsgetpassword. BOF AND rsgetpassword. When the EOF
    Response.Redirect ("forgotpassword2.asp")
    End If
    % >

    < %
    Set myMail = CreateObject ("CDO. Message")

    myMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
    myMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpserver") = "" SMTP Server ""
    myMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    myMail.Configuration.Fields.Update
    myMail.Subject = "Site name > here's your password!
    myMail.From = "[email protected]."
    myMail.To = rsgetpassword. Fields.Item ("Email"). Value
    myMail.TextBody = "password:" & rsgetPassword.Fields.Item("Password"). "» Value & vbcrlf
    myMail.Send
    Set myMail = nothing
    % >

    I don't get any errors, but there is no e-mails either.
    myMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    I tried to change my code to connect to a remote server and adding the IP address of the server. When I do that my page completely fails and the only error I get is Error 500. That tells me that there is an error in programming or server. Please help me

    I took a long break of it and when I came back, I changed my sendusing towards = 2. The reason why I do not think that it worked was because I sent myself a test email and it was taken in the 40s and I do not see it in my Inbox.

  • How to send an email to the entire group

    Original title: sending a group e-mail

    I created a group in my contacts, but don't know how to send an email to the entire group.   When I type in the name of Group 5 of the 25 show upward.   I'm doing something wrong.

    You will need to provide much more information.  For example, what email program are you using?  Is it perhaps Windows Live Mail 2012?

  • current state of the package has been abandoned...

    Hi all..

    I get the following error only for the '"first run" ", even the package is in State"valid ". If the execute the same package to new "second run", it works ok.

    usually we complie all 'invalid objects"in the diagram, when we pass the TEST or PRE-PRODUCTION code approx.

    but I get the following error, even if the package is in State "valid".
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package "TEST_OWNER.TEST_PKG" has
    been invalidated
    ORA-04065: not executed, altered or dropped package
    "TEST_OWNER.TEST_PKG"
    ORA-06508: PL/SQL: could not find program unit being called:
    "TEST_OWNER.TEST_PKG"
    ORA-06512: at line 2
    I went through the next thread, blu explained the cause of this error,
    but we receive this error even when the package is 'valid' State too?
    Re: When should be package invalidated?

    Which session refers to a package for first time package is instantiated in memory of the session. If the package is recompiled, Oracle assumes he may have changed and the package in memory session instance is no longer valid. This is why any reference to this package made by this session will raise an error.

    Session 1:

    SQL> create or replace
      2  package pkg1
      3  is
      4  g_n number;
      5  procedure p1;
      6  end;
      7  /
    
    Package created.
    
    SQL> create or replace
      2  package body pkg1
      3  is
      4  procedure p1
      5  is
      6  begin
      7  for rc in (select * from emp) loop
      8  dbms_output.put_line(rc.empno);
      9  end loop;
     10  end;
     11  end;
     12  /
    
    Package body created.
    
    SQL> exec pkg1.p1;
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    This package is instantiated PKG1 is session1. Then session 2:

    SQL> alter package pkg1 compile body;
    
    Package body altered.
    
    SQL> 
    

    Back to session 1:

    SQL> exec pkg1.p1;
    BEGIN pkg1.p1; END;
    
    *
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "SCOTT.PKG1" has been invalidated
    ORA-04065: not executed, altered or dropped package body "SCOTT.PKG1"
    ORA-06508: PL/SQL: could not find program unit being called: "SCOTT.PKG1"
    ORA-06512: at line 1
    
    SQL>
    

    SY.

  • Hallo why? When I update ios. When the image has finished error itunes and usb

    Hallo why? When I update ios. When the image has finished error itunes and usb

    Connect the iPhone to the computer that you are synchronizing usually with

    and follow the prompts to iTunes on this computer. If you

    do not generally in sync with a computer, you should always use

    iTunes on a computer to complete the update.

  • Satellite A50-109 shut down when the CPU has to work hard

    My laptop off when I open the www with graphic flash or when the processor has to work hard. What's wrong?

    Hello

    Looks a bit like an overheating problem. What do you think??
    Have you checked the temperature with a tool of freeware as an Everest for example?

    To my knowledge the laptop stops automatically if the temperature rises to a critical level to prevent material damage!

    I think that the cooling modules don t runs properly and therefore the temperature doesn't fall.

    Usually, fans can turn with a maximum yield due to dust and debris inside the laptop.
    From time to time it s advisable to clean the fans with a spray of air compression. It can be everywhere for laptop and computer purchase.

    You should also be able to clear any dust and debris using a normal vacuum.
    Place it on the grids of aspiration air for a few seconds. But be careful.
    A strong suction can damage fans.

    If you have no experience, I recommend to contact a technician and would like to ask for help

    Good luck

  • which method is called when the screen has lost focus but stays on blackberry?

    Hello

    I want to know in which method is called when the screen has lost focus, but always visible BlackBerry?

    For example, a screen is in the foreground and we disply dialog box so that the screen is visible but not to focus, therefore, at this time that methos called when we close this dialog box?

    Please, help me please please

    Override the following methods in your class to screen according to your needs

    1. when the screen button to the stack

    Call

    onDisplay() or

    onUiEngineAttached(boolean attached) - so attached is true then your screen is at the top of the screen

    2. When you are in a backlight and the lcd screen turns off to your state of rest and turns on again when you actively use this form

    call

    onVisibilityChange(boolean visible) - if visible is set to true, then you get the focus when the lcd display turns

    3. when your application moves to the background by clicking the red end button (i.e. without quiting the app, yet yours is active in the background)

    call

    onExposed() - when your application comes to the foreground of the background or during any type of screen that is in the top get popped

    & call

    onObscured() - when your application moves to the background, or when a screen pushed above your current screen more

  • I get an error message when the computer starts, "failed to prepare the critical file! Engine out of Chameleon.

    I have a laptop Asus N53Jq, 16 GB, 224 GB ssd, I get an error message when the computer starts, "failed to prepare the critical file! Engine out of Chameleon"when I click the computer works fine, but it seems that she was taking more resources without doing me anything. Do know how to solve this problem.

    Original title: Chameleon engine

    I uninstalled ASUS Splendid Video Enhancement Technology to my computer and it solved the problem!

  • How to send an email to the project mobile flex for blackberry playbook?

    Hello friends,

    I developed a small application for playbook. I want to send an email, use adoble flash builder burrito, there is no built-in functions available to send emails in flex 4.5, it can be achieved throug php, cold fusion, or asp.net. I don't know how do it, can someone send me the example to send an email to the project mobile flex.

    Thank you...

    There is no native email client in "flex". PB is not currently an API to use any "native" or "bridged" or by e-mail. If you just want to open the current, the default e-mail client, you can use navigateToURL with 'mailto' as url, or you can send the information to your own server, which can in turn SMTP information. Otherwise, you will need to write your own.

  • When the Surface has a direct purchase for HBO Go app?

    When the Surface has a direct purchase for HBO Go app?

    Original title: HBO Go

    Hello Susan,

    Thanks for posting your question on the forum of the Microsoft community.

    Unfortunately, HBO Go app is not included as an application that can be purchased directly for Windows Surface and we have all the information when it is included in the Windows store.

    Please let us know if you have any other questions.

    Thank you

Maybe you are looking for