0

Imagine there is a web-application where in multiple users are logged in . The user can fill and submit a form in it. Now when this request is processed behind the scene a table is maintained which keeps track of a number whenever such kinds of form submission is made which keeps on incrementing and this number is associated with the form that is submitted and sent to other system.

There can be a situation when in two different users log in at the same time and submit their forms . In such cases the number generated is same for both the user which is causing ambiguity . I have looked up and seen discussion on two phase commits , but is there anything in the procedure that can be done to achieve unique consistency.

The query is simple in the procedure that is used.

..... Start transaction update form_id_configuration set idValue = {lastvalue} + 1; ....

Has anybody come across this kind of situation . I want to achieve uniqueness.

  • 2
  • Good thought . sequence is db managed. Considering the fact that there can be changes made in the id that is being generated, it would be problematic as i have already said that the system is concurrent. – Ruud Gullit Nov 12 '21 at 08:05
  • @RuudGullit When a value of a sequence is requested, that value is returned only once. The next request to that sequence will get the next number. This is similar to an auto increment column (like the primary key). – Progman Nov 12 '21 at 08:57

0 Answers0