title: How to dynamically add content to email in PL/SQL?
body: <p>I'm using Oracle apex and am trying to practice with automatic emails. Ideally, this is how the scenario would go: A user can 'recommend' games to friends through his wishlist. The user selects the game(s) they would like to recommend though a checkbox, then selects the friends and email content. The code I have in place for this is as follows:</p>
  
  <pre><code>DECLARE
  content VARCHAR2(4000) := :P4_EMAIL ||  'Here are the game(s):';
  game VARCHAR2(100);
  i    NUMBER := 1;
  
  /*Declare the cursor and it's query */
  cursor CURSOR IS
      SELECT name
      from gs_games
      where game_id = APEX_APPLICATION.G_F01(i)
      FOR UPDATE;
  
  BEGIN
  FOR i in 1..APEX_APPLICATION.G_F01.count
  LOOP
  OPEN cursor;
  FETCH cursor INTO game;
  CLOSE cursor;
  END LOOP;
  htmldb_mail.Send(p_to   =&gt; :P4_FRIENDS,
                   p_from =&gt; 'gametracker@gametracker.com',
                   p_subj =&gt; 'Game recommendations from ' || :F56_USER_NAME,
                   p_body =&gt; content || ' ' || game);
  END;
  </code></pre>
  
  <p>This only partially works. For a single selection, everyone works perfectly, but once the user selects multiple games, then the email only contains the name of the first game checked off, instead of every game as it should. I realize this is tied to the way I've got my cursor set up, but I'm not entirely sure how I can use it while keeping that for loop active. Does anyone have any ideas? Thank you.</p>