Do you use Oracle?
If you use Oracle you can validate the data in a declarative way with the use of a fast refresh materialized view, you have to add a check constraint to this materialized view. This means that the validation will be done when a commit is happening.
Edit1
It saddens me a little that oo didn't anwer my imho really very simple question, so I don't know whether or not he/she uses Oracle, but anyway:
Let's create a table with a materialized view log, a materialized view with a group by on resourceid and a check constraint to check that the sum of PctOfTime equals 100 for every resourceid.
create table applicationresources
(
id number(10) not null primary key,
applicationid number(10) not null,
resourceid number(10) not null,
pctoftime number(3) not null
);
create materialized view log on applicationresources
with rowid (id,applicationid,resourceid,pctoftime) including new values;
create materialized view pctoftimecheck
refresh fast on commit
as
select sum(pctoftime) sum_time,resourceid
from applicationresources
group by resourceid
/
alter table pctoftimecheck add constraint c1 check(sum_time=100);
Now two examples:
Example1 (will succeed):
insert into applicationresources values (1, 1, 1, 50);
insert into applicationresources values (2, 2, 1, 50);
commit;
Example2 (will fail on commit because sum=101)
insert into applicationresources values (3, 1, 2, 50);
insert into applicationresources values (4, 2, 2, 50);
insert into applicationresources values (5, 3, 2, 1);
commit;
SQL> Error: ORA-02290: CHECK-constraint (DSEDD.C1) violated.
See for more info: http://rwijk.blogspot.com/2009/06/fast-refreshable-materialized-view.html