title: MySQL equivalent of Oracle's SEQUENCE.NEXTVAL
body: <p>I need to be able to generate run a query that will return the next value of ID on the following table:</p>
  
  <pre><code>CREATE TABLE animals (
       id MEDIUMINT NOT NULL AUTO_INCREMENT,
       name CHAR(30) NOT NULL,
       PRIMARY KEY (id)
  )
  </code></pre>
  
  <p>In Oracle you can call NEXTVAL on a sequence and it gives you the next sequence (note: without having to do an insert on the table). </p>
  
  <p>After googling around I found that you can find the current value of auto_increment by using the following query:</p>
  
  <pre><code>SELECT Auto_increment 
  FROM information_schema.tables 
  WHERE table_name='animals';
  </code></pre>
  
  <p>The problem is I would like the value to be increment every time the value is queried. In Oracle, when you call nextval, the value of the sequence is incremented even if you don't insert a row into a table. </p>
  
  <p>Is there any way I can modify the above query so that the value returned will always be different from the last time the query was called? i.e. Auto_increment is incremented every time it is checked and when used on a query it would use a new value. </p>
  
  <p>I am using Spring JDBCTemplate so if it can be done in one query the better. </p>