title: Using when exists in case statement issue
body: <p>I want the 'color' set to 'gold' if the member and member_levl from tabC exists in the premium_tab. Now, it does work if I only have 1 record in the premium_tab. But when I have multiple records in the premium_tab, it sets all their 'color' values to null ('') regardless if the member exists or not in tabC. Not sure what the issue is and how to fix this?</p>
  
  <pre><code>begin for rec in premium_tab
   loop for rec1 in default_tab
    loop insert into attire_tab (outfit, outfit_val)
     values (rec1.outfit_code,
             case rec1.outfit_code when 'color' then (case when exists (select 'x' from tabC where member=rec.user and member_levl=rec.lvl)
                                                           then 'gold' else '' end)
                                   else 'other' end);
       end loop; end loop; end;
  </code></pre>