Alerts Email PLSQL using DBMS_JOB

I need assistance with a request something like this:

If someone does all changes to a purchase order existing or add additional topics, the corresponding speaker should get an alert message informing them of the changes. A purchase order has usually a structure of PO header in an array of header and details (elements) in a table separate detail that is for a record in the table header, there can be several entries in the secondary table (pretty simple).

The alert requirement was conducted using UTL_SMTP and having an insertion after trigger placed on the table detail call a stored procedure that would make use of UTL_SMTP and send an email, but the problem is that, for each insert on the detail table, the user will receive an email. If, say, 50 items are added to the PO the users Inbox will be flooded with 50 electronic messages!

I'm trying to find a way to use annex DBMS_JOB email stored proc to send e-mail after validation occurs on the detail table but I also need to purchase order number and the elements that have been added in the session of a user to the op all at once, then compose the email with the purchase order number and all the elements that have been added and send the message , rather than send an email to each for each item.

Any help in this scenario would be greatly appreciated! Here's what's there currently.

Structure of table PO_Head-
---------------------------------------------------------------------------------------------
PO_NUMBER, PO_DATE, PROVIDER, CREATE_DATE, LOCATION...

Structure of table PO_detail-
----------------------------------------------------------------------------------------------
PO_NUMBER, ITEM, ORDERED_QTY, LATEST_SHIP_DATE...

----------------------------------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE TRIGGER PO_DETAIL_CHG_AIR
AFTER INSERTION
ON PO_DETAIL
FOR EACH LINE
DECLARE

.. statement and sliders...

BEGIN

.......
......

If ALERT_AP_ORDER_CHG (...,: new.item,:new.ordered_qty,: new.po_number) = FALSE then
raise PROGRAM_ERROR;

......
......

EXCEPTION
While OTHERS then
.......
.....
END PO_DETAIL_CHG_AIR;

----------------------------------------------------------------------------------------------------------------------------------------------

CREATE or REPLACE FUNCTION ALERT_AP_ORDER_CHG (..., item, ordered_qty, po_number)
RETURN BOOLEAN IS
......
.....
statements
.....
v_From VARCHAR2 (80): = "[email protected]";
v_Recipient VARCHAR2 (80): = NULL;
v_CarbnCopy VARCHAR2 (80): = "[email protected]";
v_Subject VARCHAR2 (80): = 'changes made to the PO;
v_Mail_Host VARCHAR2 (50): = "hub.new.xyz.com";
v_Mail_Conn utl_smtp. Connection;
CRLF VARCHAR2 (2): = Chr (13) | Chr (10);
BEGIN

...
...
v_Subject: = v_Subject | po_number;

v_Mail_Conn: = utl_smtp. Open_Connection (v_Mail_Host, 25);
UTL_SMTP. HELO (v_Mail_Conn, v_Mail_Host);
UTL_SMTP. Mail (v_Mail_Conn, v_From);
UTL_SMTP. RCPT (v_Mail_Conn, v_Recipient);
-Create HTML message
UTL_SMTP. Data (v_Mail_Conn,
' Date: ' | TO_CHAR (sysdate, ' Dy, hh24:mi:ss DD month YYYY ') | CRLF.
' De : ' || v_From | CRLF.
"Subject: ' |" v_Subject | CRLF.
' De : ' || v_Recipient | CRLF.
"Cc:". v_CarbnCopy | CRLF.
' Content-Type: text/html; "|| CRLF.
' < html > < body > < of police 'arial' = > ' |
"FYI, an existing purchase order has been modified. Details below-' | CRLF. CRLF.
' < tr > < td > order No. # < table > < td > ' | po_number | "< table > < /tr > ' | CRLF.
"< tr > < td > < td > < table > element. point | » ('|| L_desc |') ' |' < table > < /tr > ' | CRLF.
"Quantity / < tr > < td > < table > < td >. ordered_qty | "< table > < /tr > ' | CRLF.
"Date < tr > < td > < table > < td >. SYSDATE | "< table > < /tr > < / table > ' | CRLF.
' Note This is an Auto generated email. Please do not respond. (< / police > < body / > < / html > ');

UTL_SMTP. Quit (v_mail_conn);

Return TRUE;

EXCEPTION
WHEN utl_smtp. Transient_Error or utl_smtp. Permanent_Error then
L_error: = "unable to send an email: ' |" SQLERRM;
return FALSE;.
END;

Published by: user9207221 on December 16, 2011 07:22

Published by: user9207221 on December 16, 2011 07:28

delete, delete, delete the EXCEPTION handler all & together.
There is nothing else that a bug waiting to bite the unwary.

Tags: Database

Similar Questions

  • Hi, while writing an email online using Firefox 3.6.3, I was using one of the "CTRL + left arrow or right" to move the cursor on the text. I must have pressed some other key because the screen has become huge - and I can't scroll vertically or horizont

    Hi, while writing an email online using Firefox 3.6.3, I was using one of the "CTRL + left arrow or right" to move the cursor on the text. I must have pressed some other key because the screen has become huge - and I can't scroll vertically or horizontally, which makes the pages of Mail of Hotmail impossible. I have connected since using the Explorer MSFT and it works very well. This problem occurs only on the page of Mail of Hotmail Live not on the home page or other.
    Could you please let me know if there is a problem with Firefox, or if you have any advice on how to restore the appearance of Hotmail in Firefox?

    This has happened

    Just once or twice

    == I'm compiling an email in Hotmail Live

    See this:
    https://support.Mozilla.com/en-us/KB/page+zoom

  • Last update, iOS 9.2, eliminated the function "search" in the email, I used massively.  Tried to restore to a previous backup, 15/2, and 'research' does not return, always shows iOS 9.2 in my settings.  How do I return search function?

    The last update, iOS for iPad mini 4, 12.7 9.2 GB of capacity, has eliminated the search function in the email, I used very strongly.  Tried to restore to a previous backup, 15/2, and 'research' don't come back and always shows iOS 9.2 in my settings.  Yesterday, a new useful feature appeared, an entry 'return to mail' at the top left of the screen (Safari, at least), which now also seems to be missing. Siri, I don't want to bother with earlier, continues to display everytime I try to go back to the home page of apps/programs, is driving me crazy.  Except for limited iPad usage (mail, Safari for the links from emails, play music, some reading books mainly) mainly am only moderately competent Windows PC user, so am frustrated at best. Any ideas on how to restore or add this feature to return search (and get Siri shut up!)?

    You can disable Siri in settings/general if you want to completely disable the function.  I suppose that you use the Home button to return to the home screen.  If you press the button too long, Siri is enabled.  Too long is not very long, so you must quickly press and release the Home button.

    Good day.

  • Email sent using gmail pop, while on outlook express 6 is checked in to the gmail server sent the file, but not on my express outlook sent folder.

    Original title: problem with outlook express 6 and gmail

    Email sent using gmail pop, while on outlook express 6 is checked in to the gmail server sent the file, but not on my express outlook sent folder.  How can I have email sent appear in Outlook express 6 sent folder.  I put it as pop not imap

    Any suggestions?

    Check in OE under Tools | Accounts | Mail | Properties and ensure that it is not set to IMAP.  It seems to me that if you use IMAP folders.  If it isn't, in addition to the suggestion of Umesh, you can try to go to file | Identities and install a new identity and add your POP3 account and see if it works very well.

    Steve

  • Recovery of emails archived using Windows Mail

    I need the instructions step by step on how to get my email archived using Windows Mail as the mail program. Please help me!

    OK, if you only use Windows Mail, then the best place to ask questions about this program is in the newsgroup, Windows Mail here:

    In a News Reader: microsoft.public.windows.vista.mail
    On the web: http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.windows.vista.mail

    Sorry I was not able to help you, but should Windows Mail experts in this discussion group. MS - MVP - Elephant Boy computers - don't panic!

  • Use an email once used to the same printer on e-print

    How can I use the same email, I used to use for a printer before you reinstall it? The eprint centre tells me that the email already exists!

    Thanks in advance

    At the moment e-mails will lock for 6 months if you change email, or remove the printer. However, you can add a number at the end to make it a little easier to remember a new email.

  • Help with alerts Email blackBerry Smartphones

    I have alerts email on silent, but when the sounds together are set to normal, I always get an alert when an e-mail arrives. I want to just get an alert when the phone rings or a text is available in.  Any help?

    You can set it to phone calls only or if you also need the text alerts, you will need to create a custom profile.

  • Manage several emails, I use several accounts (Yahoo & Hotmail) e-mail, but is there a way to control these accounts of e-mail to a Web site or anything that is free?

    Manage several emails, I use several acconts e-mail (yahoo & hotmail), but is there a way to control these email account from a Web site or something that free s and respect privacy, pls kindly include G mail other than the 2 aforementioned accounts. TQ.

    original title: manage several E-mails.

    Download a real email client (application) to connect your email on your local computer.  In this way, you can manage all the emails in one application and even keep local e-mail backups if you want.

  • Can I add an email account using POP?

    Can I add an email account using POP?

    The Mail app currently supports e-mail services that use Exchange ActiveSync (EAS), including Hotmail and Gmail.  There is currently no support integrated into the application Mail for pop.

    For more information about setting up your e-mail accounts, see

    Mailing address: frequently asked questions

  • How to set up a new email account using the same e-mail address of my old computer?

    How can I configure sup a new email account using the same e-mail address of my old computer?

    Hi Melanie,

    Are you referring to the Mail app or user login account?

    If you are referring to the Mail application, you can consult the following link: Set up Mail and add contacts

    If you are referring to the user login account, you can consult the following link: create a user account

    It will be useful.

    Keep us informed on the status of the issue.

  • Can we use DBMS_JOB for parallel processing?

    Hi all

    I wonder if we create 10 jobs each inserts 100 rows in a specific table. Will it be parallel? In other words, please correct me if I'm wrong, when a job starts Oracle does not wait for it until he finished. It run other respectively, right? If this logic is true, then we can use DBMS_JOB and DBMS_SCHEDULER for parallel processing?

    Thanks in advance.

    Yes, you can use these 2 packets for parallel processing. I suggest using DBMS_SCHEDULER instead, because it is much more powerful than DBMS_JOB. I noticed a kind of latency using DBMS_JOB between the presentation of each batch.

    I usually combine DBMS_SCHEDULER with DBMS_ALERT to acknowledge the completion of the work.

    As suggested, you can also use DBMS_PARALLEL_EXECUTE. This package uses the dbms_scheduler logic.

  • Configure Alerts email for hardware failures

    Our ESXi 5.5 environment goes live today and now it will be in production I was wondering if there was a way to configure alerts email for hardware failures. For example, if a disk goes wrong in our RAID array, I want to be emailed on this subject. Is this possible, and is there a link to find out how to implement that?

    Go to the Administration menu-> vCenter Server Settings-> E-mail and enter SMTP server and the account of the sender.

  • Email address used for the deleted record

    A couple of years ago, we bought adobe Acrobat pro 10. My Secretary has registered the software from his email address. She has since left the company and its address has been deleted. I have a new computer and cannot download the software because the email address used for registration is no longer valid! I have the serial numbers and the license certificate. Can someone help me.

    Thank you

    Peter

    I don't know what are your terms of organization, but I think that you could recreate the e-mail address so that it can be used.  I know that I can create sub-accounts for my own e-mail service.

    Aside from that, you might be able to download the demo version of the software directly via the site linked below and then use your current serial number to activate it.

    Don't forget to follow the steps described in the Note: very important Instructions in the section on the pages of this site download and have cookies turned on in your browser, otherwise the download will not work correctly.

    http://prodesigntools.com/tag/DDL

  • Hi, I bought LR4 (MAC) as a student. I changed my MAC and now I forgot what account/email I use while buying LR4. Can you please help me download my LR4 for Mac thank you, Sabrina.

    Hi, I bought LR4 (MAC) as a student. I changed my MAC and now I forgot what account/email I use while buying LR4. Can you please help me download my LR4 for Mac thank you, Sabrina.

    You can download Lightroom 4 of

    http://www.Adobe.com/support/downloads/product.jsp?platform=Macintosh&product=113

    However, you will need to enter the serial number to activate the product

    If you are unable to locate the serial number and then contact adobe once customer

    http://helpx.Adobe.com/in/contact.html?step=LTRM-Photoshop-lightroom_membership-account-PA yment_payments-invoices-orders_stillNeedHelp

  • Implementation of a parallel process using DBMS_JOB

    Hi all

    We use oralce 9.2.0.8.0 d/b,.
    There are procedures (3) running for each provider sequentially and inserting/updating of values in different tables
    These jobs longer account of the needs both to reduce the time to take for these jobs.

    I am using dbms_job to treat this work in parallel so that all tasks will run in parallel.

    is that this approach will lock the tables at the level of the table or simply stored?

    I can't able to establish the parallel process on planning the tool itself, which is the best approach...?

    do I need consider as all other settings before approacing... ?


    Thank you
    ARD

    986803 wrote:
    If two different jobs insert 2 different rows in the same table then so there is no problem locking?

    If you have a table with no index, no trigger, etc. two sessions making INSERT operations are never blocks between them. If you have no trigger, no index bitmap and you can ensure that only unique index on the table is a column on which no two sessions will never be in conflict, the two sessions does not block each other.

    I am a little concerned by your description of the index, however. It does not seem logical that something like unique VENDOR_ID otherwise than in the VENDOR table. You say that each session has a different VENDOR_ID which seems to imply that there are only 3 values VENDOR_ID (one per post). Which implies that he can never y 3 rows in the table (one per VENDOR_ID) which seems unlikely in particular where you plan jobs running in parallel.

    Justin

Maybe you are looking for

  • Satellite M70 shows BSOD on startup

    My M70 shows me a blue screen... "" "A problem has been detected and windows has shut down to prevent damage to your computer." " Make sure you have enough disk space. If a driver is identified in the stop message, disbale the driver or check with th

  • I have corrupted files as determined by SFC scan. How can I fix that SFC could not fix?

    I used a (RegZooka) registry repair tool and must have damaged some files.  At the time I discovered, RegZooka could not help me, but another suggested that I have run the System File Checker.  I did and got a newspaper that shows some of the files t

  • Sale on App World

    I did a few themes and would like to put it on App world. I was wondering if anyone had some success stories to share. I'm trying to set realistic expectations for my self. Before that I shall pay the seller's claim, I was just looking for a range of

  • If I run windows ultimate upgrade on my Home Premium 64-bit will this affect my ability "tactile"?

    I have a touchscreen computer, Windows 7 Home premium 64-bit computer. If I turn my drive to upgrade Windows 7 Ultimate 64 bit will it affect the touchscreen somehow?Any help would be grateful because I don't want to ruin the touch screen ability.,.T

  • The change of system - U.S. language / EN for CS

    Hello, I have Win RT initially also installed Czech language? Or is / will be possible to add this language to the system? In this case - where and how? Thank you very much for the quick responses.