e-mail when the condition meets

Hello

I have managed to get the code for the e-mail to a user, but I want to know where I can put the condition if it meets the specific condition for only then email? In addition, can I get the results in the body of the email also?

DECLARE

v_From VARCHAR2 (80): = ' [email protected] ';

v_Recipient VARCHAR2 (80): = ' [email protected] ';

v_Subject VARCHAR2 (80): = 'High CPU;

v_Mail_Host VARCHAR2 (30): = 'server ';

v_Mail_Conn utl_smtp. Connection;

CRLF VARCHAR2 (2): = Chr (13) | Chr (10);

BEGIN

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);

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.

'To: '     || v_Recipient | CRLF.

CRLF.

"some text" | CRLF.    -Body of the message

"more text of the message. CRLF

);

UTL_SMTP. Quit (v_mail_conn);

EXCEPTION

WHEN utl_smtp. Transient_Error or utl_smtp. Permanent_Error then

raise_application_error (-20000, "cannot send an email: ' |") SQLERRM);

END;

/

Thank you.

Hello

user8786417 wrote:

I tired the code, but it has the following error:

DECLARE

v_From VARCHAR2 (80): = ' [email protected]';

v_Recipient VARCHAR2 (80): = ' [email protected]';

v_Subject VARCHAR2 (80): = 'High CPU;

v_Mail_Host VARCHAR2 (30): = 'server ';

v_Mail_Conn utl_smtp. Connection;

CRLF VARCHAR2 (2): = Chr (13) | Chr (10);

num_found PLS_INTEGER;

BEGIN

SELECT COUNT (*)

IN num_found

Select *.

of CSD_CALL_RATING;

IF num_found > 0

THEN

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);

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.

'To: '     || v_Recipient | CRLF.

CRLF.

"some text" | CRLF.    -Body of the message

num_found | 'lines of qualification found in another_table "| CRLC |

"more text of the message. CRLF

);

UTL_SMTP. Quit (v_mail_conn);

END IF;

END;

Error on line 1

ORA-06550: line 11, column 21:

PL/SQL: ORA-00923: KEYWORD not found where expected.

It's one of these error messages that actually means what he says.

Each SELECT keyword must be followed by exactly 1 FROM keyword, like this:

SELECT  COUNT (*)

IN num_found

FROM another_table

WHERE the cpu > = 100;

In your code, you have the statement following (or the compiler will treat this as a single statement because he has only a semicolon):

SELECT  COUNT (*)

IN num_found

Select *.

de CSD_CALL_RATING;

It is 2 SELECT keywords but only FROM 1.

In addition, whenever you SELECT in PL/SQL, youhave to specify what you will do with the results (e.g., SELECT... ( IN).

How to fix the code depends on what you want to do.  I don't know what you want to do, so I can't help much.

Tags: Database

Similar Questions

  • case structure: to run once when the condition is true

    I have a case structure in my program. I use this to count the number of cycles in my experience. I have a knot of feedback (image of the program here attaced) within a box structure. I want the case structure to run only ONCE when the condition is "TRUE". Each "TRUE" represents each cycle. The problem that I'm facing here is that the box structure is permanently running as long as it is 'TRUE' instead of running once and wait for the next 'TRUE '.

    Temporaritly I use a timer inside (as you can see in the picture) to contain the program for the next 'REAL' to come. I hold as by case so I know exactly the time. Is it possible to make the case structure running only once when the condition become ' TRUE and wait for the next "REAL"?  OR is there any other loop that case structure that make this work?

    Hi aneps,

    PtByPt_BooleanCrossing is your friend!

    You really need to work on the analysis/description of your problem: you don't want to run the case as long as the entry is set to TRUE, but you want to run the case at the entrance of the past from FALSE to TRUE!

  • How to write a procedure for setting Out when the condition fails

    Here's my query, it works very well when the condition is fulfilled with the valid user ID and password

    create or replace
    PROCEDURE ISVALIDUSER / * this is procedure created to validate the connection information to users created on 09212012 by Charbonneau * /.
    (
    pUSERID IN VARCHAR2,
    Ppassword IN VARCHAR2,
    pUSERTYPE OUT NUMBER
    )
    AS
    tmpUSERID VARCHAR2 (30);
    tmpPASSWORD VARCHAR2 (150);
    tmpIsative VARCHAR2 (10);
    BEGIN
    SELECT Userid, PASSWORD IN tmpUSERID, tmpPASSWORD FROM USERMASTER WHERE USERMASTER. USERID = pUSERID and USERMASTER. PASSWORD = Ppassword AND isactive = "Y";
    / * Check ID USER Existed or not * / / * PASSWORD verification is Existed or not * /.
    IF tmpPASSWORD = AND tmpuserid = pUSERID THEN pPassword
    USERTYPE of SELECT INTO pUSERTYPE FROM USERMASTER WHERE USERMASTER. USERID = pUSERID and USERMASTER. PASSWORD = pPassword;
    ON THE OTHER
    BEGIN
    1 SELECT INTO pUSERTYPE FROM DUAL;
    END;
    END IF;
    END;


    Here I am facing a problem when I get invalid user or password ID it is failed - 1 in pUSERTYPE which is OUT setting
    Please suggest

    You need to read about the exceptions - {message identifier: = 9360013}

    create or replace
    PROCEDURE ISVALIDUSER /*This is Procedure created to validate Login users information Created on 09212012 by Chakravarthy*/
    (
    pUSERID IN VARCHAR2,
    pPASSWORD IN VARCHAR2,
    pUSERTYPE OUT NUMBER
    )
    AS
         tmpIsative VARCHAR2(10);
    BEGIN
         SELECT USERTYPE INTO pUSERTYPE
         FROM USERMASTER WHERE USERMASTER.USERID=pUSERID
         and USERMASTER.PASSWORD=pPASSWORD AND isactive='Y';
    exception
         when no_data_found then
              pUSERTYPE := -1;
    END;
    

    You store your password without encrypting? One who is to have access to your table will see the password...

  • show/hide the button with the icon enabled when the condition is met

    Hello

    I created a B button with an icon of a sign of the green check mark.
    It must appear next to another A button when a condition is met.

    How can I better get this working B key, without using something else than the APEX.

    The condition is that some data has been inserted by clicking A button or simply exist in the database table.

    I tried conditional display of point with conditiontype "PL/SQL Expression.
    but could not make it work.

    TNX to tide me over.

    Cara

    Hello

    If you use the condition EXISTS (SQL query returns at least one row)?

    This could give idea how
    http://Apex-SMB.blogspot.com/2009/05/How-to-determine-if-user-can-view-apex.html

    BR, Jari

    Published by: jarola 18 November 2009 16:07

    Oh,.
    I paste the wrong link and can not find more good.
    Well anyway in this link is also example to condition EXISTS

    To meet this requirement I can add a condition (SQL Exists) to the Report 2 region on Page 2:
    

    It takes something similar and your table selection

  • How to change a password by e-mail when the password of the account field is missing

    I changed my password in Gmail.  There is a place to change the passwords in my other four accounts of mail (in the settings), but not Gmail.  What can I do to get it back?

    Where to change the password? On a computer?

    You cannot be used if the field is gone, but are you be sure that the field has disappeared? If Yes, try to send an email and see if you are prompted to enter the new password. When something similar happened to me, the password field popped up right in the mail application when I tried to send the e-mail.

  • Why I - Phone 4 always shows use of 2.6 GB mail when the total of all the mail is only 5 MB?

    Why my I-Phone 4 mail application always displays the use of 2.6 GB when the total of all messages is less than 5 KB?

    When in your Mail pass of mailboxes, and then select the account in your email. From there, see if you have other folders where the post goes as undesirable or sent, Deleted etc.

  • Prevent the child class dependency when the conditional use disable to specify the class in the development environment

    Hello

    I develop an application that I want to run on the normal systems and in real time using LabVIEW Proffesional Development System 2012 SP1

    To control how the application interacts with the user, I created a class that defines the type of user interface behavior that should allow me to have nice dialog boxes when the system is running on a machine windows and no dialog box (or any other friendly code in non-real time) if they sail on a real-time target.

    The parent class is the code that suits the actual time and the class of the child is the one with dialog boxes.

    To control the class of which it is responsible, I have a structure conditional disable. It works fine when the application is built in an executable or executable file in real time, but the problem arises when I want to use the code during development on the target in real time.

    I think that with the application under a target in real time (RT PXI), the proper case of the conditional - disable is enabled for the parent class is used, but the child classes are also listed under dependencies - I pressume it's because they exist on the block diagram in the case of persons disabled conditional turn off the diagram.

    This means that I can't deploy the code on the target in real time as it is unhappy with the class of the child code - even if it will never run.

    To save the poster my real project, I created an example with a Parent and child class and a flag to disable conditional 'class' to illustrate the problem.

    If you run Test.vi, you will see that the child class always gets locked (i.e. is addictive) while running even if it is not called.

    So - basically my question is: is what I can do about it or will I enough to disable it with conditionals and simply put the constant to correct class on the block diagram in the tests?

    Thanks in advance

    John.

    I feel your pain.  I came across something similar some time back.

    Apparently official NOR position is that you have to put a conditional structure of Disable IN EVERY ONE OF YOUR CLASS live.  In the Windows screws, you simply have a case of empty disable conditional with the windows code in another case and vice versa on the RT.

    I also much prefer the method you describe...

  • Click on the button conditional and alert when the condition is not met

    Hello

    I have a problem with the click of a button; in my form when the user clicks on a button I have to run the True action only if an element has the value; otherwise I would show an alert message like "enter value < element >...". ».

    It seems a simple problem, I tried to insert the condition "Is not null" and warning that the action of false, but it does not work.

    Who is the Apex way to solve?

    Thanks in advance.

    Cry

    1. replace the button URL type

    Code - javascript:validate();

    2. create a javascript function in the page function and declaration of global variables

    function validate()

    {

    If ($v ('YOUR_ITEM_NAME') == ")

    Alert ('XYZ');

    on the other

    Apex. Submit ('BUTTON_NAME');

    }

  • Conditional liquid do not print when the conditions are met.

    I build a simple menu in British Colombia and for the purpose of this project, I'm going to be exposing this menu without using Module of menu in British Colombia. I use the following code:

    {% If globals.user.isLoggedIn contains 'true' %}}

    < id = "my-account-link" li > < a href = ' / my account "> < i class ="fa fa-diamond"> < / i > < span class ="-animate "> my account </span > < /a > < /li >

    < id li = "settings-link" > < a href = "/ my account-#settings" > < class i 'fa fa-sliders' = > < / i > < span class = "-animate" > my settings </span > < /a > < /li > ""

    < id = 'link-support' li > < a href = "/ my account/help" > < i class = "fa-fa-question-circle" > < / i > < span class = "-animate" > support </span > < /a > < /li >

    < id li = "logout link" > < a href = "/ LogOutProcess.aspx" > < class i 'fa-fa-sign-out' = > < / i > < span class = "-animate ' > Log Out < / span > < /a > < /li >" "

    {% other %}

    < id li = "connection-link" > < a href = "/ login" > < i class = "fa fa-sign-in" > < / i > < span class = "-animate" > Login / / Sign Up </span > < /a > < /li >

    {% endif %}

    I have used before with other snippets of code and this liquid condition print very well. For some reason, when I test the newspaper, the State still shows the wrong code even when I look through the JSON printed in the console object and the object user loggedin contains the value Boolean 'true '. Sort of at a loss as to why it is not printing when the user connects. Really want to use liquid on it and do not have to revert to the version JS of the hiding items.

    Thanks in advance to all! Best wishes!

    Well, I feel stupid, I was following the copy and the tutorials BC and pasted. Realized that I had to use operators such as "is" appropriate and «!» = ». I fixed it now

  • The deleted output tables finished when the conditional tags using build

    Hi and thanks for any help you can offer on this...

    I use the WebHelp/print Documentation HR 6 single-sourcing method, and I created two build conditional tags - "OLH" (online help) and "printed". Essentially, the conditional tags are awesome... except when my content includes HTML tables. If a table exists within a set of conditional tag material, material that exists AFTER the table (and outside the conditional tag) is omitted from the finished output (i.e., regardless of the unique method out of the Source used for the production of finished products - WebHelp or printed Documentation). In some cases, only certain documents after the table is omitted.

    For example, in a comprehensive document which includes a specific paragraph and a data table I want to exist only in my printed docs. I apply the tag "Print" in this paragraph and the table. Once I have generate the schema of WebHelp (or even preview and apply the term appropriate on the conditional tag build), labeled "Print" content is left out, but is so everything that followed it. even if I don't apply a tag of conditional compilation to the material in question.

    I have a workaround, but it sucks... If I delete the tables (and re - format the text content), everything is fine, and the build tags work properly. The thing is, I want to use the tables in my content.

    I wish a WYSIWYG solution, but if I have to change the code, I'll live... I just need to know what and where to change (I played with the ' < p > < style = "" x-condition: printed; ' > ' tag and additional locking "< /p >" and "< / style >" tags, but that has not worked ").

    Thank you for taking the time to review that and for any help you can give.

    Hi Vernholio,

    This looks like a problem that is covered in the forums before. Basically, it happens when the Board as a whole has been select. If you click and drag to select all of the cells in the table, then apply the conditional tag, there should not be problems with the rest of the content.

    See excerpt on Peter Grainge's site #69

  • Need to send an automatic e-mail when the hold is released

    Hi team,

    I need to send mail to customers when released hold it manually in OM
    Kindly do me what event fires when you release the hold manually. (Action-> exit wedges)
    Thank you
    Suresh.S.

    Hi, Suresh

    There may be a way for your condition.

    Made (not test) with the form personliaze, as follows:
    triggering event: after application
    1. check the wedges which extract 2 is released or not.
    If it is rejected then send an email.
    2 Get current still holds.

    The first time, 1 will not execute anything it either because of holds has yet.
    Later 1 occur normally when release hold. (Action-> blocks of liberation)

    Kind regards
    Leno

    Published by: Leno Sun on 2013/05/10 0:36

  • Data does not appear when the condition is applied

    Hi all
    I have a small request. Trying to use an if condition to achieve the following:

    If the exchange rate is 1, so I need to concatinate the field returned with $.
    And if it isn't, then concatinate with #. Exchange rate is another column of the same group.

    I tried to use the following text:

    <? xdofx:If Petrofac-PTSExchangeRate = 1 then concat('$',Revenue)
    concat('#',Revenue) other end though? >

    But it does not show me any result in the revenue column.

    Any ideas?

    Thanks in advance,
    Imtiaz.

    Use the xdoxslt functions.

  • How to configure a group of contact by e-mail when the words 'New group contact' do not appear in my toolbar?

    Help Vista says only "click New Contact Group on the toolbar."

    http://www.vista4beginners.com/missing-buttons-from-Windows-contacts-toolbar

    The tutorial above should help you.

    First, launch Windows Contacts. Then click on organize and select Properties.

    In the Properties of Contacts window, go to the Customize tab. Here you can choose the type of folder to use for the Windows Contacts. Most likely, it is now changed for all objects, Documents or the music.

    Under the text box that says "This file as a template to use", there is a selection area with the elements. Click on it, select Contacts , and then click OK.

    Your Windows Contacts toolbar now returns to normal.

    http://Windows.Microsoft.com/en-AU/Windows-Vista/managing-your-contacts

    Manage your contacts

    See you soon.

    Mick Murphy - Microsoft partner

  • Prevent sending e-mail when the new user of the IOM is created

    Hello

    I installed OIM11.1.1.5.2. Whenever a new user is created using the delegated Administration console an email with the following content is sent to the corresponding user:

    "Congratulations!" Your account has been created successfully! Your user name is < USER NAME >"

    How can I stop this email sent?

    Thanks in advance.

    Naviagte to IOM--> Advanced webconle--> export file Deployment Manager--> select model Notification & search click-->, select the model and click Export... it will be saved as an XML.

    Since it's OOTb, u also get any otheer environment later

    Regards
    user12841694

  • How to remove duplocate record when the condition is about 2 different columns

    I have a table containing information of MySQL master-master relationship, look like that.
    Master_node1   Master_node2
    ----------  ----------
    A1        A2
    A2        A1
    B1        B2
    B2        B1
    Now, I want to single related just look like that, (it sames as remove duplication of table replation)
    Master1 Master2
    ----------- -----------
    A1         A2
    B1         B2
    Could someone give me a tip how to do?
    Thanks in advance!

    Best wishes
    Satine
    with t
    as
    (
    select 'A1' c1, 'A2' c2 from dual union all
    select 'A2', 'A1' from dual union all
    select 'B1', 'B2' from dual union all
    select 'B2', 'B1' from dual union all
    select 'C1', 'C2' from dual union all
    select 'D2', 'D1' from dual
    )
    select c1, c2
      from (
              select c1, c2, row_number() over( partition by substr(c1,1,1) order by c1) rno
                from t
           )
     where level  = 1
     start with rno = 1
    connect by nocycle c1 = prior c2
    

Maybe you are looking for

  • Loss of function of mouse Scroll Wheel

    I took a leap and a leap of faith, the upgrade to Firefox 3. something to 11.0. I work through awkward differences in the user interface, but I'm having a problem with the scrolling. I can't put my finger on any particular website or the size of the

  • Satellite C660D - software to control the fan speed?

    Just brought a C660D. Someone knows the software to control the fan speed? My laptop CPU fan always turns to 74-80% of max speed. That's a lot of noise. I tried cpucool, but it did not work. If does not work, the fan speed will remain at the temperat

  • Question: two tables in a pool, load balancing, etc.

    Hello So I'm sort of confused about how it works.  I know I can put two tables that are part of the same group in the same pool, and I know I can create a volume that spans the two tables and the EQL will spread the volume also between two boxes, etc

  • Install Windos 8 clean

    I need to do a clean install of windows 8, since my product key is for windows 8, but can't find iso downloads for windows 8.1

  • Why will not allow muse "'" as a widget

    I am trying to add an e-mail address into a form on a muse site that has a "'" that it contains.Whenever I try the muse closed and the top comes this message (see screenshot below)Help!