title: NVL or EXCEPTION NO_DATA_FOUND
body: <p>i have in a procedure which fills a table the following sql</p>
  
  <pre><code>SELECT NVL(SUM(COL1), 0),
         NVL(SUM(COL2), 0)
    INTO v_mytable.COLUMN1,
         v_mytable.COLUMN2
    FROM t1, t2
   WHERE t1.id = t2.id
     AND t1.date = t2.date
  </code></pre>
  
  <p>also, for 99% of the table rows, those columns = 0 and this query take a long time to be executed when it will return 0 for both columns in most cases.  </p>
  
  <p>Is it better to use exception handeling as the following :  </p>
  
  <pre><code>BEGIN
    SELECT SUM(COL1),
           SUM(COL2)
      INTO v_mytable.COLUMN1,
           v_mytable.COLUMN2
      FROM t1, t2
     WHERE t1.id = t2.id
       AND t1.date = t2.date
  EXCEPTION WHEN NO_DATA_FOUND THEN
    v_mytable.COLUMN1 := 0 ;
    v_mytable.COLUMN2 := 0 ;
  END;
  </code></pre>
  
  <p>Thanks.</p>