Hi all,
I'm interested in whether a select for update
query will lock a non-existent row.
e.g.
Table FooBar with two columns, foo and bar, foo has a unique index
- Issue query
select bar from FooBar where foo = ? for update
- If query returns zero rows
- Issue query
insert into FooBar (foo, bar) values (?, ?)
- Issue query
Now is it possible that the insert would cause an index violation or does the select for update
prevent that?
Interested in behaviour on SQLServer(2005/8), Oracle and MySQL.