For example, if the last value used by the Oracle sequence was 100 and you would like to reset the sequence to serve 225 as the next value.
I'm working on an open source elearning system called Moodle which usually uses My Sql or Postgresql, but can also use MSSQL and Oracle.
UPDATE 2: Found some existing code in Moodle that resets the sequence, I had wrongly assumed the naming convention for the sequences was created by Oracle but its Moodle. Normally, you adopt some naming convention for sequences, say [table_name]_SEQ , so it's more readable. To find out which sequence is related to which table, you have to check the database design which was created by the developers. Check if the tables have triggers which populate the sequence controlled columns.
A client wishes to use Oracle, which I have limited experience of. I used a script to transfer data from My Sql into Oracle, including the ID to keep the references.
But now when creating a record I get the error message : ORA-00001: unique constraint (SCHEMANAME.
TABLENAME_ID_PK) violated I'm guessing the sequences weren't updated when I inserted the ID's? @Russell England : There is no "sequence name for table name" in Oracle.
Is there an easy way to update all the table sequences to the last ID number used + 1 in each table? UPDATE : I can use this to get the last number in the sequence The last_number column has values but it looks like they are lower than the last id used in the table. Sequence is not related directly to a table - you may use the same sequence to generate values in multiple tables or columns.
When the system comes back up, Oracle will cache new numbers from where it left off in the sequence, ignoring the so called "lost" sequence values.
You can change the LASTVALUE for an Oracle sequence, by executing an ALTER SEQUENCE command.
In Oracle, you can create an autonumber field by using sequences.
A sequence is an object in Oracle that is used to generate a number sequence.