I want to restrict users from entering more than 3 records with color = 'red'
My Food Table is for my intention A.) Retrieve the current count so that I can determine whether another record is allowed or not. B) Stop any other process from inserting any other Red Records, while it is in a process, so for to update
.
I want to do something like this:
Cursor from cur_cnt foo to count count (*) cnt, where foo.color = 'foo' for updates to 'red'. Id;
Will this satisfy my needs or will not lock only the rows in the count (*) who have foo.color = 'red'
?
This will prevent users from updating only the selected rows, not by adding new joints. The only way to implement this rule is by combining the check barrier (on the "Master" table) and a trigger on the "Foo" table that updates the master table (something like EMP and DEPT is used for familiarity By:)
Change the table deputy entry (Manager_Graph integer default 0 zero; Obstacle manager_account_check check (manager_count & lt; = 3)); Enter emp on each line or create emp_trg trigger before updating or deleting, if you want to insert or update: new.job = 'MANAGER', then install the Deept Set manager manager count = manager_count + 1 where Deptno =: new.dptno; end if; end if; If updated or deleted then: old.job = 'MANAGER', then direct the Setup Manager Manager- manager_count-1 where deptno =: new.dptno; end if; end if; End;
This allows more than one user to get the desired locking by inserting, updating or deleting 'manager' employees at one time.
Comments
Post a Comment