title: How to work around ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc
body: <p>I want to lock one record in a table.
  The record is specified as "the next that has ID greater than..."</p>
  
  <pre><code>CREATE TABLE test (id number);
  
  SELECT id
  FROM (SELECT id 
        FROM test
        WHERE id &gt; 10
        ORDER BY id)
  WHERE ROWNUM = 1
  FOR UPDATE;
  </code></pre>
  
  <p>This seems intuitive and easy. But it is not. Any ideas?</p>
  
  <p>P.S.</p>
  
  <p>I do need the existing query to remain the same because it is a cursor and there are several places that use this cursor's %rowtype. </p>