title: Using decode in where clause
body: <p>I have a <code>DECODE</code> in my <code>WHERE</code> clause like this:</p>
  
  <pre><code>Where id = decode('&amp;flag','Yes',(Select id from tab where id &gt; 10),0)
  </code></pre>
  
  <p>This code works if the subquery returns one post. If I returns several I get an error like, ORA-01427, "Single-row subquery returns more than one row"</p>
  
  <p>I've tried to change the '=' to an 'in' but I still get the same error!</p>
  
  <p>Any ideas? </p>
  
  <p>extended example:</p>
  
  <pre><code>WHERE Dop_id = (DECODE ('&amp;prep_flag', 'Yes', 
      (SELECT Dop_id FROM 
                     ( SELECT DOP_id, name FROM TABLE)
                      WHERE name IS NOT NULL) 
   , Dop_id))
  </code></pre>
  
  <p>as mention this works if the select statmen returns on row, and not several.</p>