Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

For loop sends email for each record

user12251389Feb 22 2017 — edited Feb 22 2017

I have below procedure which sends email for every KPI_NAME exist in the TRACK_KPI table

create or replace procedure execute_send_mail_smtp as

begin

FOR KPI_TRACK_ROW IN (Select KPI_NAME FROM RATOR_MONITORING.TRACK_KPI)

LOOP

  SEND_MAIL_SMTP(

    'support@leo.com',           --Sender

    'r.d@leo.com',           --Recipient

    'TEST- KPI NOT RUNNING',                    --Subject

    'Below KPIs are not running:' || KPI_TRACK_ROW.KPI_NAME  --Message

  );

END LOOP;

end execute_send_mail_smtp;

This log is incorrect. I want to send in only one email all the KPI_NAME from TRACK_KPI table. The records should be formatted and for every records there should be new line in email. Also i want to check if there is no recors exist then it sends an email as 'the KPI does not exist'. I really wondered if i can do this in my procedure. I also want to send email to more than one recipient then is it possible to provide more than one recipient?

This post has been answered by Saubhik on Feb 22 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 22 2017
Added on Feb 22 2017
19 comments
868 views