【发布时间】:2016-07-18 09:49:00
【问题描述】:
如果用户输入的比率超过 100,我想在计划比率字段上应用验证,然后在验证触发器时显示错误我该怎么做,因为计划比率是相同的字段但有不同的记录
【问题讨论】:
标签: sql oracle11g oracleforms
如果用户输入的比率超过 100,我想在计划比率字段上应用验证,然后在验证触发器时显示错误我该怎么做,因为计划比率是相同的字段但有不同的记录
【问题讨论】:
标签: sql oracle11g oracleforms
您可以设置一个不可见的计算项,汇总计划比率字段,例如将其命名为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.
【讨论】: