How to change master block's data when detail block's data changed? [message #357472] |
Wed, 05 November 2008 08:49 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
since
Messages: 18 Registered: May 2008
|
Junior Member |
|
|
I have a master block like:
ID, Name, Number
1, aaa, 44
2, bbb, 33
detail block like
ID, Operation, Number
1, ADD, 5
1, ADD, 22
Related with ID.
The question is, When the detail block record changed (insert/modify/delete), How to update the master block's 'Number' column?
Thanx!
[Updated on: Wed, 05 November 2008 08:50] Report message to a moderator
|
|
|
|
|
|
Re: How to change master block's data when detail block's data changed? [message #357594 is a reply to message #357564] |
Thu, 06 November 2008 00:16 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
since
Messages: 18 Registered: May 2008
|
Junior Member |
|
|
djmartin wrote on Wed, 05 November 2008 19:09 | What is the relationship between 'number' in the detail block and 'number' in the master block because 5 plus 22 is not 44.
David
|
The 'number' column do not have any relationship.
For example, I insert an record to the detail block like:
1,ADD,6
the Number in master block of current record should changed from 44 to 50 (44+6=50)
thank you for your reply!
|
|
|
|
|
|
Re: How to change master block's data when detail block's data changed? [message #357625 is a reply to message #357605] |
Thu, 06 November 2008 01:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
since
Messages: 18 Registered: May 2008
|
Junior Member |
|
|
djmartin wrote on Thu, 06 November 2008 00:48 | Seeing that this is a straight master-detail relationship, and the master record you want to change is this detail record's master then just do a ':blk_mst.number := :blk_mst.number + :blk_dtl.number' in the When-Validate-Item' trigger. You don't have to be IN an item to change it.
David
|
Thank you very much! That works!
|
|
|