Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
now i am creating a accounting software using oracle
in that one of the major table is daybook from that i created all reports etc..

structure is like this

id slno acc_id amount

1 st trans

1 1 1 500
1 2 27 -500


second trans
2 1 15 700
2 2 14 - 100
2 3 28 -400
2 4 90 -200


i have to check is the transaction sum is zero

is it possible to set any constraint or any other way in oracle
Posted
Updated 18-Feb-15 18:52pm
v2

1 solution

You can't create such constraint and in this case you can't use triggers since examining the same table that has been modified would cause a ORA-04091.

One possibility is to use a stored procedure which would contain the check and if the sum is anything other than zero an error would be raised. All modifications should then go through this procedure.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900