Send email when a value in the table reached a certain number

Hello,
I have a value in a table that when this value is equal or greater than a certain value, I want to send an email to alert. How do I accomplish this? Do I create a trigger? Do I write an o/s korn script and schedule to run continuosly and check for the value to send an email? Thanks.

Hi, i think that the best form is create a trigger on the table, when insert o update the data send the email when the value accomplish the condition.
Look the next code, it is a package that send emails,
CREATE OR REPLACE
PACKAGE oracle_administrator.dbms_mail_server
IS
P_SERVERNAME VARCHAR(50);
P_RCPT VARCHAR(50);
P_FROM VARCHAR(50);
P_TO VARCHAR(50);
P_SUBJECT VARCHAR(50);
P_BODY CLOB;
P_MAIL UTL_SMTP.CONNECTION;
PROCEDURE INIT_SERVER;
PROCEDURE SEND_EMAIL;
PROCEDURE WRITE_DATA(PARAM_DATA IN CLOB);
END;
CREATE OR REPLACE
PACKAGE BODY oracle_administrator.dbms_mail_server
IS
PROCEDURE SEND_EMAIL
AS
BEGIN
UTL_SMTP.CLOSE_DATA(P_MAIL);
UTL_SMTP.QUIT(P_MAIL);
END;
PROCEDURE INIT_SERVER
AS
BEGIN
P_MAIL :=UTL_SMTP.OPEN_CONNECTION(P_SERVERNAME);
UTL_SMTP.HELO(P_MAIL,'hostname');
UTL_SMTP.MAIL(P_MAIL,'dbaoracle');
UTL_SMTP.RCPT(P_MAIL,P_RCPT);
UTL_SMTP.OPEN_DATA(P_MAIL);
UTL_SMTP.WRITE_DATA(P_MAIL,
'FROM: ' ||P_FROM || UTL_TCP.CRLF||
'TO: ' || P_TO || UTL_TCP.CRLF ||
'SUBJECT: ' ||P_SUBJECT || UTL_TCP.CRLF ||
'MIME-VERSION: 1.0' ||CHR(13)|| CHR(10)||'CONTENT-TYPE: TEXT/HTML' || CHR(13)||CHR(10));
END;
PROCEDURE WRITE_DATA(PARAM_DATA IN CLOB)
AS
BEGIN
UTL_SMTP.WRITE_DATA(P_MAIL,PARAM_DATA);
END;
END;
Luck
Have a goof day.
Regards

Similar Messages

  • Why can't I send email when I upgrade to the latest edition of firefox?

    Firefox version 3.6.23 works fine, but whenever I try a newer version I find that I can read my email, but cannot send emails. Is there a fix?

    First of all, I'd like you to excuse my English. I'm Italian and I speak few words of English.
    I'm using Apple product since 1984. I remember very well the first machine I used, an Apple MacIntosh Plus! I've been always proud of my many Apple's products: computers, iPods, iPads, Apple Tvs and so on.
    Now I'm very sorry for what it's happening in these days (and never happened before!). Apple has released the latest version of iPad/iPhone OS (iOS 6) and Mac Os X (v10.8.2). The results are that I cannot sync my devices (iPhones/iPads) with iTunes. Every pictures I took during many years of activity disappeared from my devices.
    I'm expecting a new patch from Apple, but I'm very sorry because this great and glorious factory is now very similar to Microsoft ...

  • On my Mac Pro, when I send emails, it always gives me the option of adding an attachment with a paper clip. Today, the paperclip has vanished. What do I do ?

    On my Mac Pro, when I send emails, it always gives me the option of adding an attachment with a paper clip.
    Today, the paperclip has vanished. What do I do ?
    Simon

    http://www.apple.com/support/mail

  • Why is it that when i send emails duplications were created? the recepient says he receives multiple emails from me...

    why is it that when i send emails duplications were created? the recepient says he receives multiple emails from me...

    It is a bug. Try quitting Mail and then reopen it.
    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Mail Feedback

  • Apex 4: How to send email when form is submitted?

    Hi,
    Using Apex 4.0.2 on DB 11g, I've a form with around 80 fields and 4 check boxes.
    When the user clicks on submit button, besides saving the values in the database I also have to send emails. Selection of the 4 check boxes decides whom the email has to go to, i.e if 2 check boxes are checked, send 2 emails.
    In the emails, some contents will be based on the data the user has filled and some from the database; also data in different emails will be different.
    From what I've read, to send email I've to use APEX_MAIL API and make a conditional process depending on the check boxes selected. Also that I have configure mail server in database and that mail sever has to accept autonomous user (i.e. sending email without password)
    Is this the right approach?
    How can I do this?
    Is there any example/tutorial that will guide me in doing this?
    Thank you for your time.

    The Apex email package is very simple.
    v_id := apex_mail.send(
              p_to        => v_to,
              p_from      => v_from,
              p_subj      => v_subject,
              p_body      => v_body,
              p_body_html => v_html);It's up to you how you get the values of the variables.
    Also that I have configure mail server in database and that mail sever has to accept autonomous userThe mail server is not in the database, but you do have to inform Apex which server to use (smtp.yourcompany.com).
    Most smtp servers require user and password. In that case you have to write your own procedure. Search the pl/sql forum for email authentication and you will find many examples.
    It is probably also possible to configure the smtp server in such a way that requests coming from the database do not need authentication. That is how we have it configured (but I don't know how the administrator did it, though).

  • Cannot send email when clicking lonk on web page

    I cannot send email when clicking link on web page. 
    When I would click the link to send via email I was being directed to hotmail to open new account.
    Today the tech tried to assist me and completely messed up my email capabilities by setting up
    windows live account.
    I am thoroughly disgusted with FIOS internet services..Every time I've called them in the past month problem has been with someone else whose portal services they are using.
    I cannot send emails because all my contact information cannot be moved.
    I'm paying for FIOS internet service that is almost non existent.
    THe VZ in home agent doesn't work nor does the FIOS information site.
    My next move is to get rid of FIOS.
    They create more problems then they solve with me.

    If I understand your problem correctly, you are having trouble when clicking on a MailTo link on any webpage? What loads when you click this type of link is a setting in your browser. If you tell us what browser you are using, we can try to direct you to the setting.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • How to display the values from the table in the screen

    Hi,
    I have created a screen where i will enter the values for the field treshold amount and desc and if i press update button  .it will update the new values by overriting the existing values .
    Now i have got requirement i need to create a button show which will display the existing value from the table. always there will be only one entry...in this table
    Please can one give me idea...to do this
    or sample code...thanks in advance
    regards
    paveeeeee

    Define a function code 'SHOW' for your button. In your PAI module, when you check for various sy-ucomms, check for 'SHOW' also.
    Your code will be like this:
    Case sy-ucomm.
      when 'SHOW'.
         perform show_details.
    endcase.
    In the perform, you can fetch the data from the table and put it in global variables. In the PBO, move the data from the global variables to the screen fields so that they get displayed on the screen.
    Hope this helps. Reward points for useful answers.
    Regards
    Nithya

  • HT4979 why can I not send email when away from my home wifi? Am able to receive messages OK, and outgoing mailserver is correct?

    Why am I unable to send email when away from my home wifi ? I am able to receive mail OK, and have double- checked the outgoing server which is correct. This problem is consistent with my Macbook Pro, iPhone, and iPad2.
    Attempts to send messages results in them sitting in the Outbox and never- ending 'sending message' displayed.
    I am able to send using my   me.com  server.
    Home service provider is Cogeco.
    Any help would be appreciated.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try a Reset - iPad How-Tos  http://ipod.about.com/lr/ipad_how-tos/903396/1/
    Or this - Delete the account in Mail and then set it up again.
     Cheers, Tom

  • How to display(binding) values in the table from more than one node?

    Hi,
    I have two nodes (TRIPS & AMOUNTS)in the context. How to bind these values into the table control?
    When i bind second one, first one is getting replaced.

    Hi Mog,
    Of course it is possible to create a table from attributes of more than one node, and in some cases this is still necessary, but you have to do this the hard (manual) way.
    If you have a table control, have a look at the properties and the elements belonging to it.
    First of all, there is the property "dataSource", which binds to a multiple node (let's name it TableRootNode). This means that for each element of THIS node, one row is created. In each row the data of exactly one element of this TableRootNode is displayed.
    Then you have columns in this table. Inside of the columns there is a header and an editor. The editor is the interesting part.
    Normally the primary property of this editor is bound to an attribute of the TableRootNode. Then everything works as expected. If it binds to an attribute of a subnode (SUB) of TableRootNode, then in row i the data of the subnode of the i-th element of TableRootNode is displayed. There is no need for SUB to be a multiple node, but it must not be a singleton.
    If you bind a property of the editor to an attribute, which does not lie in the subtree of TableRootNode, then you will see the same value in each row.
    Now it depends on the structure of your context. Take the node, which is relevant for the change in each row (I assume it is TRIPS) and bind the table to the node as you are used to. Then for each additional column, you have to create a new column in the tree, create a new header element with a title and a new editor (e.g. textview or inputfield) and then bind the right property of the editor to the corresponding attribute in node AMOUNTS).
    If these 2 nodes do not have parent-child-relationship, the tip to create a new node, which consists of the attributes of both nodes is the only solution.
    Ciao, Regina

  • Exit in DP90 and how to get value in the table

    Hi all,
    My requirement is when execute DP90(create billing request), the amount in the table must be validated when I click the "Billing Request" button.
    Please tell me the user_exit, BADI or any other enhancement which can I use to validate the amount in that transaction.
    And how to get the amount(amount to be Billed, Amount rejected) value in the table after that??
    Thanx

    Hi Teja,
    Check the BADI (SE18) - BADI_SD_DPBP - Extensions in SD for DP90 with Billing Plan

  • How to pass line item values in the table paramer of FM

    Hi all,
    When i will give the import of  the FM as VBELN"sales order number.
    I want to display all the line items for "PO Quantity in the out put of the FM.
    For this i thnk i have to pass the line item values in the table parameter of the FM.
    Can any body please tell me how to pass the values for the line items in the table parameter fo teh FM.
    Please give a example.
    Thanks

    Sub pLoopThroughPivotFields()
    Dim oItem As Excel.PivotItem
    Dim oField As Excel.PivotField
    Set oField = ThisWorkbook.Worksheets("Sheet1").PivotTables("Pivot Table name").PivotFields("field name")
    For Each oItem In oField.PivotItems
    oField.CurrentPage = oItem.Name
    'Put your copy code here
    DoEvents
    Next oItem
    End Sub
    Felipe Costa Gualberto - http://www.ambienteoffice.com.br

  • How to Maintain Values in the Table control?

    Hi,
    I'm Saikumar.
    I've done a table control program.
    When I click SAVE or ENTER Button, the values are getting saved into the database(This is working alright)......but when I click those buttons, The values entered in the table control are getting cleared.
    What should I do in order to have those values in the table control itself when I click SAVE/ENTER? (I need to create multiple records at a time)
    What I've done is:
    IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
    INSERT into <database table> values wa_matgl.
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    Refresh it_matgl.
    endif.
    I tried many ways but the vales are getting cleared in the table control? (I need to create multiple records at a time).
    Please suggest a way to overcome it.
    Thanks in advance,
    saikumar

    Hi ...
    Just to add...
    were there any values in the internal table it_matgl  initially in the PBO screen to be shown to the users ?
    <u>if the answer is no...then......</u>
    i came across the same coding in DEMO_DYNPRO_TABCONT_LOOP_AT.....
    here also in PAI..when we press enter..the values are not retained...
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    <b>because i believe the modify statement is not working.coz the it_matgl is empty..pls check if sy-subrc = 0....after the modify statement....if it is not...then we need to insert the data into the it_matgl using an append statement</b>
    for this it_matgl needs to be with header line...
    Pls explore the following....
    data : it_matgl type table of XXXX with header line.
    in the section
    IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
    INSERT into <database table> values wa_matgl.
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    <i>if sy-subrc <> 0.
    move corresponding wa_matgl to it_matgl.
    append it_matgl.
    clear it_matgl.
    endif.
    endif.</i>
    Pls check and revert
    Regards
    Byju

  • How to update values in the table control at  Cat2 transaction,

    Hi,
    i am working on cat2 transaction, here
    i am using the exit_saplcats_006 and updating values at catsdb table, but i want to display this values at the table control in the cat2 transaction.
       can any one provide me solution for this same.
    Regards

    Hi Suresh
      this is actual requirement
    in the CAT2.
    1. Add a new column for WBS description and derive the value as per the FS
    2. Retrieve project number and description and update in the column specified
    3. When a service order is selected it should do the same for 2.
    4. Finally repeat for the worklist view (which is the section above)
       here i am able to display values at data entry area
    for service order and network but not worklist area ?
        updation is not coming, can u plz go throw it..
    Thanks
    Chinna

  • SQL Server 2012 Management Studio: Creating a Database and a dbo Table. Inserting VALUES into the table. How to insert 8 Values for future use in XQuery?

    Hi all,
    In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'MacLochlainnsDB')
    DROP DATABASE MacLochlainnsDB
    GO
    CREATE DATABASE MacLochlainnsDB
    GO
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL)
    INSERT INTO marvel
    (avenger_name)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8)
    I got the following error Message:
    Msg 110, Level 15, State 1, Line 5
    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
    How can I correct this problem?
    Please kindly help and advise.
    Thanks in advance,
    Scott Chang
    P. S.
    The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
    You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
    DECLARE @x xml;
    SET @x = N'<marvel>
    <avenger_name>Captain America</avenger_name>
    </marvel>';
    SELECT @x.query('/*');
    You can query the avenger_name elements from the marvel_xml table with the following syntax:
    SELECT xml_table.query('/marvel/avenger_name')
    FROM marvel_xml;
    It returns the following set of avenger_name elements:
    <avenger_name>Hulk</avenger_name>
    <avenger_name>Iron Man</avenger_name>
    <avenger_name>Black Widow</avenger_name>
    <avenger_name>Thor</avenger_name>
    <avenger_name>Captain America</avenger_name>
    <avenger_name>Hawkeye</avenger_name>
    <avenger_name>Winter Soldier</avenger_name>
    <avenger_name>Iron Patriot</avenger_name>
    You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
    SELECT xml_table.query('/marvel[4]/avenger_name')
    FROM marvel_xml;
    It returns the following avenger_name element:
    <avenger_name>Thor</avenger_name>

    Hi Scott,
    The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
    object within it.
    To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
    Open SQL Server Management Studio
    --> Go to Object explorer(the left panel by default layout)
    --> Extend "Security"
    --> Extend "Logins"
    --> Right click on your login, click "propertites"
    --> Choose the "Default database" at the bottom of the pop-up window.
    --or simply by T-SQL
    Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
    Regarding your question, you can reference the below.
    SELECT * FROM master.sys.all_objects where name ='Marvel'
    --OR
    SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
    --usually the OBJECT_ID is used if a if statement as below
    IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
    PRINT ('TABLE EXISTS') --Or some other logic
    What is the sys.all_objects? See
    here.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • TS2621 why may I send email when wi-fi is enabled, but not when it is disabled?

    iphone 4s with verizon will send email via wi-fi but not 3G. Are there any ideas why?

    Depends on the email account.  If it is from your Internet provider they may only allow use of their SMTP server for sending emails when on their network.  To send emails when not on their network (i.e. when using Cellular data) it would require using a different SMTP server.

Maybe you are looking for