Link to home
Start Free TrialLog in
Avatar of mjfigur
mjfigur

asked on

Trigger insert sequence from defined set of values

I am not quite sure how to describe it but I have an application where end users submit accounts to be worked and they all go in a table. I am in need of assigning these accounts to a group of ten other users for example. These ten users have their own personal user id's.

Thus when the account is inserted into the table a trigger needs to insert a specific user id in the "Assigned" column and do so in a sequence to ensure an equal number of accounts per person. Just not sure how to design this.

Thanks in advance.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Round robin? So every 10th record is assigned to the same person?

Try the MOD operator against the sequence.

Not 100% accurate since sequences are not gapless but something like setting assigned to: Mod(sequence.nextval,10)
ASKER CERTIFIED SOLUTION
Avatar of Franck Pachot
Franck Pachot
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mjfigur

ASKER

Thank you that is such a great idea. Will have it pull dynamically assigning them when they are requested will allow for my fluidity especially when one of the users may be out of the office on a given day or week.