Can a transaction safely guarantee this?
I have two tables:
Groups:
GroupId: int (auto increment)
GroupName: varchar
IsDeleted: bit
Items:
ItemId: int (auto increment)
ItemName: varchar
GroupId: FK into Groups table
IsDeleted: bit
For record keeping, I do not want to actually delete Groups and Items, so instead, I have an IsDeleted flag for each.
My business logic says that all non-deleted items must reference to a non-deleted group. If a group is deleted, then all referring items must be deleted at the same time.
Can a transaction guarantee me that someone won't be creating a new item and assigning it to a group at the same time that I am deleting a group?
If in my "insert" transaction, I do a select on the group id to verify that IsDeleted = 0, will the transaction protect the record from update by the "delete" transaction?
Thanks,
...Matt
Subject
Views
Written By
Posted
Can a transaction safely guarantee this?
1974
January 31, 2012 06:24AM
879
January 31, 2012 02:51PM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.