问题
I made a query that shows the latest status of different concurrents.
Take a look at this:
select 'The concurrent '||program||' with request_id '||request_id||' ended with status '||
status as message, request_id
from
(
<the subquery>
)
where rn = 1
and status in ('WARNING','ERROR','STAND BY');
It works just fine, everytime i run it, it shows something like this:
|The concurrent Sales with request_id 987987678 ended with status WARNING|987987678
Now, i need to create a procedure (here is where i got stuck).
1-I want to create a communication table to hold e-mail addresses of each individual person
2-I want to modify my procedure because it does not seem correct
This is my procedure:
create or replace procedure pr_mail_me is
v_email_test varchar2(100) := 'myemail@random.com';
cursor crs_request is
select 'The concurrent '||program||' with request_id '||request_id||' ended with status '||
status as message, request_id
from
(
<the subquery>
)
where rn = 1
and status in ('WARNING','ERROR','STAND BY');
begin
for c in crs_request
loop
begin
utl_mail.send(sender => 'sendercompany@test.com',recipients => v_email ,subject => 'Concurrents' ,message => c.message);
end;
end loop;
end;
The function that sends the email is this:
utl_mail.send(sender => 'sendercompany@test.com',recipients => v_email ,subject => 'Concurrents' ,message => c.message);
recipients should contain all the different email addresses
subject should contain this text: "Concurrents"
message should contain the different status of the different concurrents, i mean (this is an example):
|The concurrent Sales with request_id 987987678 ended with status WARNING|987987678
|The concurrent Prices with request_id 457857458 ended with status WARNING|457857458
|The concurrent Money with request_id 457857457 ended with status WARNING|457857457
Could you please help me to modify my procedure? I am pretty lost about the communication table
来源:https://stackoverflow.com/questions/59348037/creating-communication-table-send-email-to-multiple-addresses-oracle11g