How to use IF THEN ELSE statement in where clause in Oracle?
<p>I'm interesting that how can I use if-then-else statement or any control structure in where clause in Oracle. I want to use as:</p>

<ul>
<li>when <code>pcustomer_id IS NULL</code> then <code>WHERE c.customer_id IS NULL</code></li>
<li>and when <code>pcustomer_id IS NOT NULL</code> then <code>c.customer_id = pcustomer_id</code>.</li>
</ul>

<p>How can I do it?</p>

<pre><code>SELECT *
  FROM customer_inf c
 WHERE 
IF
 pcustomer_id IS NULL THEN ( c.customer_id IS NULL ) 
    ELSE (c.customer_id = pcustomer_id) END IF;
</code></pre>