我正在向电子邮件发送真正的oracle apex,它工作正常。但是,我需要在电子邮件中包含一条sql count语句。
我拥有的是
begin
utl_mail.send(sender => 'a@test.com',
recipients =>'a@test.com',
subject => 'FileRequest',
message => 'select count(filenumber) where status is assigned' files from registry '||:p5_filenumber ||''||' ' ||:p5_filename || ' has now been assigned to the ' || :p5_department || '');
end;
显然不起作用
我想看的是
begin
utl_mail.send(sender => 'a@test.com',
recipients =>'a@test.com',
subject => 'FileRequest',
message => 5 files from registry '||:p5_filenumber ||''||' ' ||:p5_filename || ' has now been assigned to the ' || :p5_department || '');
end;
答案 0 :(得分:2)
在发送邮件之前计算值。像这样:
declare
l_cnt number;
l_msg varchar2(200);
begin
-- select number you're interested in
select count(*)
into l_cnt
from some_table
where some_conditions;
-- compose the message
l_msg := l_cnt ||' files from registry ...';
-- send mail
utl_mail.send(sender => 'a@test.com',
recipients => 'a@test.com',
subject => 'FileRequest',
message => l_msg);
end;