title: Oracle: Create a View with Auto Increment id column
body: <p>I have created a <code>view</code> that fills data from different tables. I used <code>10 select statements</code> and   combine the results of those select statements using <code>UNION ALL</code>.</p>
  
  <p>I want to add <code>primary key column</code> to my view. because I have to create <code>XML</code> file using data in this <code>view</code>. so I need a <code>primary key column</code> for some process in my <code>XML</code> building application.</p>
  
  <p>I have add <code>rownum</code> to all my select statements. But it returned duplicate ids. because <code>rownum</code> in each select statements start from 1.</p>
  
  <p>Then I have created a sequence and tried use <code>nextval</code> . But I can't use sequence because my select statements has <code>group by</code> and <code>order by</code>.</p>
  
  <p>Is there any way to do that ?</p>