SELECT COUNT(*)
INTO v_ctr
FROM leave_type_govt_service
WHERE (
:block_name.min BETWEEN minimum AND maximum
OR :block_name.max BETWEEN minimum AND maximum
)
AND type = :block_name.type;
IF v_ctr > 0 THEN
MESSAGE('Minimum and Maximum Overlaps!');
MESSAGE('Minimum and Maximum Overlaps!');
END IF;
This code in my forms really works for inserting a new record.
But if I will update the record itself for example,
in the table 'Type 1'
Minimum Maximum
1 5
6 10
11 15
and I will update the 6 - 10 to e.g. 7, It must update but my query includes 6 - 10 data so it raise the trigger failure.
Any idea?
Note: The AND condition in the last part is for unique types. Because even if e.g. 'Type 2' has a Min and Max data same as the 'Type 1' the trigger will not prompt.