title: Selecting all rows until first occurrence of given value
body: <p>For following data:</p>
  
  <blockquote>
    <p>date|value|check<br>
    2009 | 5   | 1<br>
    2008 | 5   | 1<br>
    2007 | 5   | 1<br>
    2006 | 5   | 0<br>
    2005 | 5   | 0<br>
    2004 | 5   | 1<br>
    2003 | 5   | 1<br>
    2002 | 5   | 1  </p>
  </blockquote>
  
  <p>I need to select all rows from 2009 back until first occurrence of 0 in check column:</p>
  
  <blockquote>
    <p>date|value|check<br>
    2009 | 5   | 1<br>
    2008 | 5   | 1<br>
    2007 | 5   | 1  </p>
  </blockquote>
  
  <p>I tried with the lag function, but I was only able to check a month back.</p>
  
  <p>I am working on Oracle 10g.</p>
  
  <p>UPDATE:</p>
  
  <p>All seems to work well, my test data set is too small to say anything about the performance differences.</p>