title: NVL FUNCTION IN A SUBQUERY
body: <p>I have the following query:</p>
  
  <pre><code>select E.EQUIPMENT_GID, NVL((SELECT SUBSTR(ES.STATUS_VALUE_GID,INSTR(ES.STATUS_VALUE_GID, '.')+1 ) FROM EQUIPMENT_STATUS ES  WHERE ES.EQUIPMENT_GID=E.EQUIPMENT_GID
  AND ES.STATUS_TYPE_GID LIKE '%EQUIPMENT_STATUS' AND ROWNUM=1),'ZZZ') AS E_STATUS, NVL((SELECT EREF.EQUIPMENT_REFNUM_QUAL_GID FROM EQUIPMENT_REFNUM EREF WHERE EREF.EQUIPMENT_GID = E.EQUIPMENT_GID
  AND EREF.EQUIPMENT_REFNUM_QUAL_GID LIKE '%PERMANENT DISTRICT%' and rownum=1),'ZZZ') AS PERM_DISTRICT_REF, 'PSKL-'||REPLACE(SUBSTR((SELECT EREF.EQUIPMENT_REFNUM_QUAL_GID FROM EQUIPMENT_REFNUM EREF
  WHERE EREF.EQUIPMENT_GID = E.EQUIPMENT_GID AND EREF.EQUIPMENT_REFNUM_QUAL_GID LIKE '%PERMANENT DISTRICT%' AND ROWNUM=1),(INSTR((SELECT EREF.EQUIPMENT_REFNUM_QUAL_GID FROM EQUIPMENT_REFNUM EREF
  WHERE EREF.EQUIPMENT_GID = E.EQUIPMENT_GID AND EREF.EQUIPMENT_REFNUM_QUAL_GID LIKE '%PERMANENT DISTRICT%' AND ROWNUM=1), '.',1,1) +1 )   ), ' PERMANENT DISTRICT','') AS DISTRICT_PSKL_XID, 
  **SUBSTR(E.PARK_LOCATION_GID,5,11) AS PARK_LOCATION_GID** FROM EQUIPMENT E
  WHERE E.EQUIPMENT_GID=?
  </code></pre>
  
  <p>Now i would like to check for null values and replace them with 'zzz' in my subquery <code>SUBSTR(E.PARK_LOCATION_GID,5,11) AS PARK_LOCATION_GID</code></p>
  
  <p>Can any one suggest solution to this one.</p>