title: Oracle - Modify an existing table to auto-increment a column
body: <p>I have a table with the following column:</p>
  
  <pre><code>NOTEID      NUMBER NOT NULL,
  </code></pre>
  
  <p>For all intents and purposes, this column is the primary key.  This table has a few thousand rows, each with a unique ID.  Before, the application would SELECT the MAX() value from the table, add one, then use that as the next value.  This is a horrible solution, and is not transaction or thread safe (in fact, before they didn't even have a UNIQUE constraint on the column and I could see the same NOTEID was duplicated in 9 different occasions)..</p>
  
  <p>I'm rather new to Oracle, so I'd like to know the best syntax to ALTER this table and make this column auto-increment instead.  If possible, I'd like to make the next value in the sequence be the MAX(NOTEID) + 1 in the table, or just make it 800 or something to start out.  Thanks!</p>