如果用户输入的比率超过100,我想在计划比率字段上应用验证然后显示错误我如何处理验证触发器,因为计划比率是相同的字段但具有不同的记录
答案 0 :(得分:1)
您可以设置一个不可见的计算项,它总结计划比率字段,将其命名为SUMMARY_FIELD,然后为记录的每个计划比率项添加WHEN-VALIDATE-ITEM触发器,如下所示:
BEGIN
IF :SUMMARY_FIELD>100 THEN
message('nok'); --or whatever alert you like
RAISE Form_Trigger_Failure;
END IF;
END;
PS。如何创建计算项目:
创建计算项目:
1. In the Object Navigator, create a new interface item (make sure it is a control item). Tip: The item's datatype must be compatible with the calculation you wish to use to compute the item's value. For example, if you wish to compute an item's value with the Sum function, create an interface item of datatype Number. 2. Double-click the item's object icon to display the Property Palette. 3. Under the Calculation node, set the item's Calculation Mode property to Formula or Summary. 4. If you set Calculation Mode to: Formula, click on the Formula property, click the More button to display the Formula dialog, and type a PL/SQL expression to define the formula. Click OK to compile the expression. Summary, use the Summary Function popList to select a summary type, then use the Summarized Block and Summarized Item popLists to select the block and item whose values will be summarized to compute a value for the calculated item.