Updating oracle sequence
11-Oct-2017 21:57‘ID’; l_seq := p_tbl
I finally got around to migrating from My SQL to Oracle and was pleasantly surprised just how well of a job the SQLDeveloper Migration tool did.I’ve taken your script to the next level and added parameters that allow you to reset the sequence to any specified value zero or greater, or specifying a negative value will reset the sequence to resume with the next higher integer than the maximum value in the specified table, with sequence and primary key names derived from the table name.You can change those initializations to suit your own standard, or could add them as input variables if desired.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.
A scalar value may also be associated with an UPDATE statement, though this is not very common (as UPDATE statements are usually looking for dynamic defaults): keyword arguments also accept Python functions.