MySQL Forums
Forum List  »  Newbie

Re: Simulating sequences
Posted by: Peter Brawley
Date: July 08, 2014 08:03PM

> I don't think the issue is with last_insert_id. The issue is with the update statement

Eh? Your Update depends on last_insert_id(id+1) returning a unique new sequence value:

UPDATE sequence SET id = LAST_INSERT_ID(id + 1) WHERE sequence_id = 'MySequenceName'

To completely rule out sequence breaks you need to populate the target table from a sequence table with transactional control of all inserts updates & deletes, and logic to fill sequence holes when they occur (eg in physical failures).

Options: ReplyQuote


Subject
Written By
Posted
June 30, 2014 10:26AM
June 30, 2014 10:49AM
July 02, 2014 01:37PM
July 03, 2014 12:17PM
July 07, 2014 08:50AM
July 07, 2014 11:25AM
July 07, 2014 08:16PM
July 08, 2014 03:08PM
Re: Simulating sequences
July 08, 2014 08:03PM
July 09, 2014 12:56PM
July 09, 2014 03:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.