title: How do I compress this Oracle resultset into values according to row priority, ignoring nulls?
body: <p>I'll simplify the problem as much as possible:</p>
  
  <p>I have an oracle table:</p>
  
  <pre><code>row_priority, col1, col2, col3
  0, .1, 100, {null}
  12, {null}, {null}, 3
  24, .2, {null}, {null}
  </code></pre>
  
  <p>Desired result:</p>
  
  <pre><code>col1, col2, col3
  .2, 100, 3
  </code></pre>
  
  <p>So according to the priority of the row, it overrides previous row values, if given.</p>
  
  <p>I'm attempting to work out a solution using analytical functions over the table, but it just isn't behaving...</p>
  
  <p>I try:</p>
  
  <pre><code>select last_value(col1 ignore nulls) over () col1,
         last_value(col2 ignore nulls) over () col2,
         last_value(col3 ignore nulls) over () col3
  from (select * from THE_TABLE order by row_priority)
  where rownum = 1
  </code></pre>
  
  <p>or the inverse:</p>
  
  <pre><code>select first_value(col1 ignore nulls) over () col1,
         first_value(col2 ignore nulls) over () col2,
         first_value(col3 ignore nulls) over () col3
  from (select * from THE_TABLE order by row_priority desc)
  where rownum = 1
  </code></pre>
  
  <p>And neither seem to ignore nulls.  Any hints?</p>