Hello,
It might be a basic question, but there it goes:
I have a store procedure that first checks if the record exists and, if
it doesn't, inserts the new record.
Is the scenario below possible?
(thread1) USER1 -> check if record "abc" exists
(thread2) USER2 -> check if record "abc" exists
(thread1) USER1 -> "abc" doesn't exist
(thread2) USER2 -> "abc" doesn't exist
(thread1) USER1 -> add "abc" as new record
(thread2) USER2 -> add "abc as new record (OPS, this is an error,
because "abc" already exists, it was just inserted by USER1)
I am wondering if this kind of concurrent, multi-threaded access
happens with stored procedures.
If yes, can I execute a procedure from start to finish without any
other simultaneous procedure interrupting?
I appreciate any information about this.
Leonardo.
It might be a basic question, but there it goes:
I have a store procedure that first checks if the record exists and, if
it doesn't, inserts the new record.
Is the scenario below possible?
(thread1) USER1 -> check if record "abc" exists
(thread2) USER2 -> check if record "abc" exists
(thread1) USER1 -> "abc" doesn't exist
(thread2) USER2 -> "abc" doesn't exist
(thread1) USER1 -> add "abc" as new record
(thread2) USER2 -> add "abc as new record (OPS, this is an error,
because "abc" already exists, it was just inserted by USER1)
I am wondering if this kind of concurrent, multi-threaded access
happens with stored procedures.
If yes, can I execute a procedure from start to finish without any
other simultaneous procedure interrupting?
I appreciate any information about this.
Leonardo.
Comment