When developing Oracle Forms, do I have such a requirement? I need to execute an operation every time I leave a row of records. When when-validate-record is used, but in actual testing, how can this problem be solved sometimes? Have you tried when-leave-record? What? And when-leave-record? I have never heard ......
Before requesting the when-leave-record, let's analyze several when triggers we have seen:
When-New-record-instance
The cursor is triggered every time you enter a new row.
When-create-record
This operation is triggered when a row is inserted. If no data is input, system. record_status is new. After the data is input, system. record_status changes to insert.
When-validate-record
When the cursor leaves the current row, and the last time the current row was between when-validate-record and the time when the row was left, the data of the row is triggered when it was changed.
When a new row of data is inserted and system. record_status changes to insert, the removal is triggered once. However, when the mouse enters the row again and intends to move out, the row does not change during this period, even though the system of the row. record_status is still insert (if not saved), but does not trigger the when-validate-record event.
Similarly, when a row of data is modified and system. record_status changes to changed, the row is triggered once after the row is removed. However, when the mouse enters the row again and intends to move out, the row does not change during this period, even though the system of the row. record_status is still changed (if not saved), The when-validate-record event will not be triggered again.
Well, the time is almost ripe. It's time to start when-leave-record, Dangdang ......
How can we execute an operation every time we remove a row? From the above analysis, we know that when-validate-record does not trigger every time it leaves, but does not seem to have triggers like when-leave-record, is there no other way to deal with such a demand?
Of course not. We only need to think carefully about the trigger condition of when-validate-record. It is not difficult to find that it is triggered only when the data in the row changes when-validate-record. In this case, we manually change the data on the row to cause the when-validate-record. For example, add a non-database item (itm_dummy) to the block (blk_dummy). For the convenience of subsequent descriptions, It is set as a numeric type and the initial value is 1 ), then change the value of this item in the when-New-record-instance (because the when-New-record-instance will be unconditionally triggered every time a row is entered) (you can do this :: blk_dummy.itm_dummy
: = Nvl (: blk_dummy.itm_dummy, 1) + 1;). This means that the when-validate-record has been transformed into our own when-leave-record trigger.
How is it easy? Develop your own when-leave-record trigger.