0

Can we exclude particular values from a sequence

I have two schema .In one schema S1 I am using a sequence seq1 and now in other schema S2 I want to use another sequence seq2 but this sequence should not contain the values from seq1 Any Idea ?Please help

14th Sep 2020, 5:48 PM
anshu kulshrestha
anshu kulshrestha - avatar
1 Answer
+ 1
Does something like this work? https://stackoverflow.com/questions/41584968/skip-certain-number-in-mysql-auto-increment It looks like you can make a trigger on insert if your seq2 was used when inserting new records. The trigger could handle skipping over values that are in seq1. You could have requirements making that the best solution but I'm curious why you wouldn't want to use a GUID instead. If these things just need distinct values that never intersect, a GUID would suffice. Do you need integers that are easy for people to read or copy?
15th Sep 2020, 1:40 AM
Josh Greig
Josh Greig - avatar