title: How would I write a trigger to reorder a sequence number?
body: <p>I have a simple table in Oracle with three columns:</p>
  
  <pre><code>ID    NCHAR(10)
  NAME  NCHAR(50)
  SEQ   NUMBER
  </code></pre>
  
  <p>The <code>SEQ</code> field is 0 based and there to allow the user to drag the records and reorder the list (using jQuery sortable). I'm trying to figure out how to change all of the sequence numbers so they end up in the correct order in the database.</p>
  
  <p>I started to create a trigger before update to change all of the <code>SEQ</code> numbers based on the <code>:OLD</code> and <code>:NEW</code> values, but stopped when I realized that this would cause an infinite loop when the trigger would just keep running since I am updating a bunch of records.</p>
  
  <p>Is there a way I can get a trigger to carry out this behavior or should I write it manually into the code?</p>
  
  <p>Thanks in advance</p>