title: Update field with rownumber in oracle
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6094039/oracle-updating-a-table-column-using-rownum-in-conjunction-with-order-by-clause">Oracle: Updating a table column using ROWNUM in conjunction with ORDER BY clause</a>  </p>
  </blockquote>
  
  
  
  <p>I have a query that returns an ordered set of records, and i want to copy the rownumber of each row in the result set into a particular field called Sequence on the record itself.</p>
  
  <pre><code>SELECT ROWNUM, ID
  FROM (
      SELECT ID 
      FROM MYTABLE 
      WHERE PARENT = 1
      ORDER BY SEQUENCE ASC
  )
  </code></pre>
  
  <p>I have the ID of each row, and the <code>rownum</code> I want to put in the <code>SEQUENCE</code> field.  How can I loop through this result set and update the table accordingly?</p>