Oracle SQL: Case Statement in where clause returns an error "single-row subquery returns more than one row"
<p>Here is a select query's where clause with a CASE condition statement. I have written this for satisfying the following requirement: &quot;In case of any weekday, the result would contain the date of the next day and in case of Friday the result would include the dates of Saturday, Sunday and Monday&quot;</p>
<pre><code>where DTTM IN (case 
                      when to_char(sysdate,'day') &lt;&gt; 'friday   ' then to_date(sysdate+1,'DD/MON/YY')
                      else (select to_date(sysdate+1,'DD/MM/YYYY') + level - 1 ddate
                            from dual
                            connect by level &lt;= to_date(sysdate+4,'DD/MM/YYYY') - to_date(sysdate+1,'DD/MM/YYYY')
                            )
                end)
</code></pre>
<p>I have used <strong>IN</strong> too, but I am getting an error</p>
<blockquote>
<p>ORA-01427: single-row subquery returns more than one row</p>
<ol start="1427">
<li>00000 -  &quot;single-row subquery returns more than one row&quot;</li>
</ol>
</blockquote>
<p>Please help me resolve this error.</p>
<p>Here is the complete query for your reference:</p>
<pre><code>      select * from orders 
      where DTTM IN (case 
                                when to_char(sysdate,'day') &lt;&gt; 'friday   ' then to_date(sysdate+1,'DD/MON/YY')
                                else (select to_date(sysdate+1,'DD/MM/YYYY') + level - 1 ddate
                                      from dual
                                      connect by level &lt;= to_date(sysdate+4,'DD/MM/YYYY') - to_date(sysdate+1,'DD/MM/YYYY')
                                      )
                                end) 
      order by  DTTM; 
</code></pre>