I have a requirement to create a large number of emails and desire to use email templates. When you 'hard code' the parameters "VOTER","CHAIR" AND "PRECINCT" i.e.: "VOTER": "Joe Blow" the code runs fine. But when you parameterize the code as shown below it fails. The part that fails is the p_placeholders portions. I've experimented with a variety of approaches noon of which has worked. Anybody got a solution to this?
Keep Smiling,
Bob R
declare
cursor c1 is select precinct_name pn, precinct_chair pc, precinct_email pe
from precinct_chairs where precinct_email is not null
and precinct_chair is not null;
begin
for i in c1 loop
apex_mail.send (
p_to => i.pe,
p_template_static_id => 'WELCOME_TEMPLATE',
p_placeholders => q'~
{
"VOTER": i.pc,
"CHAIR": i.pc,
"PRECINCT": i.pn
}~' );
end loop;
apex_mail.push_queue;
end;