I need to be able to generate run a query that will return the next value of ID on the following table:
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUT
You want the next value on THAT table so that you can make rows which aren't yet inserted without disturbing other processes which are using the auto-increment?
Some options:
Go ahead and just insert the rows to "use up the sequence", mark them as pending and then update them later.
Insert in a transaction and abort the transaction - the auto-number sequence should get used up and make a "gap" in the table normally - that number is now free for you to use.
With Oracle, the sequence is completely independent of table, so processes can use the sequence or not (and they can also use the same sequence for different tables). In that vein, you could implement a sequence-only table which you access through some kind of function, and for the other processes which need to rely on the auto-increment, remove the auto-increment and use a trigger which assigns from the same sequence function if no id is provided.