title: Oracle sql query, concatenate fileds with CASE section
body: <p>I'm currently generating SQL insert statements from more than one tables, and in the generated data I need to use a CASE statement, like this:</p>
  
  <pre><code>select 'INSERT INTO TABLE1 (f1, f2, f3, f4 ...) values ('
         ||t.f1||','
         ||CASE
               WHEN t.f2 &gt; 0 THEN '1'
               ELSE '0'
           END CASE
    from table2 t , table3 t3
  </code></pre>
  
  <p>But at this point if I want to continue my statement with <code>... END CASE||','|| ....</code> I can't run the query anymore, as TOAD complains about not finding the FROM keyword.</p>
  
  <p>A quick solution was to separate the ouput into fields, then save it to text, and edit, but there must be a better way.</p>