title: Select list of values from case statement
body: <p>I have a variable <code>myvalue</code> that is a string parameter with either the value <code>"TRUE"</code> or <code>"TRUE,FALSE"</code>.</p>
  
  <p>When <code>myvalue = "TRUE"</code> I want to select just <code>N/A</code>.  When <code>myvalue = "TRUE,FALSE"</code>, I want to select a list of values from 0 to 23 (representing discrete hours of the day) with each value its own row.</p>
  
  <p>Here's what I have - what am I missing here? I want to be able to do this without storing anything in a table (temp or real). I'm getting syntax errors.</p>
  
  <pre><code>SELECT
  CASE myvalue
  WHEN "TRUE"
  THEN "N/A"
  WHEN "TRUE,FALSE" THEN (SELECT "0" FROM DUAL 
                          UNION SELECT "1" FROM DUAL
                          UNION SELECT "2" FROM DUAL
                          UNION SELECT "3" FROM DUAL
                          UNION SELECT "4" FROM DUAL
                          UNION SELECT "5" FROM DUAL
                          UNION SELECT "6" FROM DUAL 
                          UNION SELECT "7" FROM DUAL 
                          UNION SELECT "8" FROM DUAL 
                          UNION SELECT "9" FROM DUAL 
                          UNION SELECT "10" FROM DUAL 
                          UNION SELECT "11" FROM DUAL 
                          UNION SELECT "12" FROM DUAL 
                          UNION SELECT "13" FROM DUAL 
                          UNION SELECT "14" FROM DUAL 
                          UNION SELECT "15" FROM DUAL 
                          UNION SELECT "16" FROM DUAL 
                          UNION SELECT "17" FROM DUAL 
                          UNION SELECT "18" FROM DUAL 
                          UNION SELECT "19" FROM DUAL 
                          UNION SELECT "20" FROM DUAL 
                          UNION SELECT "21" FROM DUAL 
                          UNION SELECT "22" FROM DUAL 
                          UNION SELECT "23" FROM DUAL
                          )
  END as optionz
  FROM
  DUAL
  </code></pre>
  
  <p>Error message: <code>Error Code: 1242. Subquery returns more than 1 row</code></p>