Hi,
even when selecting for the record prior to inserting it, you can not be sure that it still does not exist when you do the actual insert operation (unless you lock the whole table in advance). Instead, check your data model, decide which columns make up the uniqueness of the record and then create a unique index on the table with these columns. Then, when inserting the record, the database returns an error indicating a violation of the unique index if the record already exists.
HTH,
Andreas




Reply With Quote
Bookmarks