title: Another NVL with date
body: <p>Below is a sample SQL question regarding NVL.</p>
  
  <p>Examine the structure of the PROGRAMS table.</p>
  
  <pre><code>CREATE TABLE programs (prog_id NOT NULL NUMBER(3),
                         prog_cost NUMBER(8, 2)
                         start_date NOT NULL DATE,
                         end_date DATE
                         );
  </code></pre>
  
  <p>Which two SQL statements would execute successfully? (choose two.)</p>
  
  <pre><code>A) SELECT nvl(add_months(end_date, 1), SYSDATE)
  from programs;
  
  B) SELECT to_date(nvl(SYSDATE - end_date, SYSDATE))
  from programs;
  
  C) SELECT nvl(months_between(start_date, end_date), 'ongoing')
  from programs;
  
  D) SELECT nvl(to_char(months_between(start_date, end_date)), 'ongoing')
  from programs;
  </code></pre>
  
  <p>To me, as long as the data in the programs table is not given, all the above four statements can be executed successfully.</p>
  
  <p>The correct answers are A &amp; D. There is no explanation to the answer. Does anyone know how did the author arrive at A &amp; D.  </p>