title: Oracle View problem with Select and division by zero
body: <p>I want to create an view in Oracle which calculates an &quot;utilization rate in percent&quot;.</p>
  <pre><code>AS SELECT
    sw.SWITCH_ID,
    sw.ASSET_ID,
    sw.SYSTEMNAME,
    sw.MAX_INSTALLABLE_PORTS,
    sw.INSTALLED_PORTS,
    sw.USED_PORTS,
    (sw.INSTALLED_PORTS/sw.MAX_INSTALLABLE_PORTS)*100 AS UTIL_INSTALLED_PORTS,
    sw.RES_INFRASTRUCTURE_PORTS,
    sw.USED_INFRASTRUCTURE_PORTS,
    sw.FREE_INFRASTRUCTURE_PORTS,
    (sw.INSTALLED_PORTS/sw.MAX_INSTALLABLE_PORTS)*100 AS UTIL_INFRASTRUCTURE_PORTS,
    sw.RESERVED_DEVICE_PORTS,
    sw.USED_DEVICE_PORTS,
    sw.FREE_DEVICE_PORTS,
    (sw.FREE_DEVICE_PORTS/sw.RESERVED_DEVICE_PORTS)*100 AS UTIL_DEVICE_PORTS,
    sw.RUN_DATE
  </code></pre>
  <p>Problem: sometimes sw.INSTALLED_PORTS or sw.MAX_INSTALLABLE_PORTS can be NULL (same for other UTIL Rows).</p>
  <p>Is there any nice way to do something like:</p>
  <pre><code>if (sw.INSTALLED_PORTS or sw.MAX_INSTALLABLE_PORTS == null) 
        UTIL_INSTALLABLE_PORTS = null 
  else (sw.INSTALLED_PORTS/sw.MAX_INSTALLABLE_PORTS)*100 AS UTIL_INSTALLABLE_PORTS,
  </code></pre>