Skip to Main Content

APEX

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!

Email Templates in pl/sql loops

BobRApr 23 2020 — edited Apr 23 2020

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;

This post has been answered by Jason Blankenship on Apr 23 2020
Jump to Answer
Comments
Post Details
Added on Apr 23 2020
3 comments
619 views