title: Need to reset the value of sequence in Oracle
body: <p>I'm working with Spring and Hibernate to develop web applications in Java. Let's assume that I have a table. When I delete some records from this table, sometimes I need to reset the value of the primary key field. </p>
  
  <p>Let's say that I have 10 records in a table and I delete the last 5 records. Now, when I insert new records, the value of the primary key field should be started at <code>6</code> but it would start at <code>11</code>.</p>
  
  <p>If I need to start the primary key value at <code>6</code> (<code>maximum +1</code>) in MySql, I just need to execute the following SQL statement.</p>
  
  <pre><code>alter table table_name auto_increment=1;
  </code></pre>
  
  <p>This will automatically reset the value of <code>auto_increment</code> to <code>maximum + 1</code> value of that field (May conceptually be incorrect but it works). </p>
  
  <p>In Oracle (10g), I'm using <code>sequence</code> with the primary key. Is there a way in Oracle to reset the value of the <code>sequence</code> to <code>maximum + 1</code> value when some records are deleted from the database?</p>