Passing arguments inside procedure (message) not working - oracle

不问归期 提交于 2019-12-11 01:03:27

问题


I want to create a procedure but i am having trouble while passing the arguments inside a function

This is my code:

  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 and everytime it runs i got this output:

|The concurrent Sales with request_id 987987678 ended with status WARNING|987987678 

Now, i want to create a PROCEDURE using the query written above.. i want to send a mail with that information

This is what i got so far:

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;

But this is NOT working. I want to receive the mail and that's why i am using this oracle function utl_mail.send

I need to receive this message inside the mail:

The concurrent Sales with request_id 987987678 ended with status WARNING

Also, how can i send this message to many other people? Can i use the same variable v_email_test

来源:https://stackoverflow.com/questions/59061291/passing-arguments-inside-procedure-message-not-working-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!