Examples For When-Validate-Item trigger In Oracle Forms
The following example finds the commission plan in the COMMPLAN table, based on the current value of the commcode item in the EMPLOYEE block in the form, to verify that the code is valid.
If the code in the COMMPLAN table is located, the description of the COMMPLAN is obtained and deposited in the non-database Description item. Otherwise, an error is raised.
/*
** Method 1: Using a SELECT...INTO statement, the trigger
** looks more readable but can be less efficient
** than Method 2 because for ANSI Standard
** compliance, the SELECT...INTO statement must
** return an error if more than one row is
** retrieved that matches the criteria. This
** implies PL/SQL may attempt to fetch data twice
** from the table in question to insure that there
** aren’t two matching rows.
*/
BEGIN
SELECT description
INTO :Employee.Commplan_Desc
FROM commplan
WHERE commcode = :Employee.Commcode;
EXCEPTION
WHEN No.Data_Found THEN
Message(’Invalid Commission Plan, Use <List> for help’);
RAISE Form_trigger_Failure;
WHEN Too_Many_Rows THEN
Message(’Error. Duplicate entries in COMMPLAN table!’);
RAISE Form_trigger_Failure;
END;
/*
** Method 2: Using an Explicit Cursor looks a bit more
** daunting but is actually quite simple. The
** SELECT statement is declared as a named cursor
** in the DECLARE section and then is OPENed,
** FETCHed, and CLOSEd in the code explicitly
** (hence the name). Here we guarantee that only a
** single FETCH will be performed against the
** database.
*/
DECLARE
noneFound BOOLEAN;
CURSOR cp IS SELECT description
FROM commplan
WHERE commcode = :Employee.Commcode;
BEGIN
OPEN cp;
FETCH cp INTO :Employee.Commplan_Desc;
noneFound := cp%NOTFOUND;
CLOSE cp;
IF noneFound THEN
Message(’Invalid Commission Plan, Use <List> for help’);
RAISE Form_trigger_Failure;
END IF;
END;
Examples For When-Validate-Item trigger In Oracle Forms的更多相关文章
- An Example of On-Error Trigger in Oracle Forms
I wrote this trigger around 4 years ago to handle errors in an application based on Oracle Forms 6i. ...
- Using Post-Form Trigger In Oracle Forms
Post-Form trigger in Oracle Forms fires during the Leave the Form process, when a form is exited. ...
- Using Pre-Form Trigger In Oracle Forms
Pre-Form trigger in Oracle Forms fires during the form start-up, before forms navigates to the first ...
- Learn How To Create Trigger In Oracle Forms
I have written many posts related to triggers in Oracle Forms, I have given examples for Form Level ...
- Define Custom Data Filter Using Pre-Query Trigger In Oracle Forms
Oracle Forms is having its default records filter, which we can use through Enter Query mode to spec ...
- Writing On-Error Trigger In Oracle Forms
Suppose you want to handle an error in oracle forms and want to display custom error message for tha ...
- Using Post_Query Trigger in Oracle Forms
When a query is open in the block, the Post-Query trigger fires each time Form Builder fetches a rec ...
- An Example Of Validating Text Item In Oracle Forms Using When-Validate-Item Trigger
Example is given below to validate a Text Item in Oracle Forms with specific rules condition which c ...
- How to Log Users Login and Logout Details Through Oracle Forms
Log user's login and logout details in to table through Oracle Forms using POST-LOGON and PRE-LOGOUT ...
随机推荐
- yii2的GridView和ActiveDataProvider具体使用
1.控制器中(以User模块的列表为例): 第一步: use backend\models\User;use yii\data\ActiveDataProvider; 第二步: public func ...
- Openstack的删除错误网桥,虚拟网络
在实验openstack的各种网络模式时,可能会产生一些错误的网络指向,需要删除那些网桥. 执行前 [root@node-9 ~]# ifconfig br40 Link encap:Ethernet ...
- ckeditor添加插入flv视频的插件
首发:个人博客,更新&纠错&回复 昨天写在网页中播放flv的博文的时候,想在博文中插入视频,但是发现无法实现.因为用的编辑器是ckeditor,决定自己写个插件插入视频.官方的教程在这 ...
- shell 加减乘除
#!/bin/basha=$1b=$2echo a+b=$(($a+$b))echo a-b=$(($a-$b))echo a*b=$(($a*$b))echo a/b=$(($a/$b))echo ...
- 使用ActionFilterAttribute 记录 WebApi Action 请求和返回结果记录
使用ActionFilterAttribute 记录 WebApi Action 请求和返回结果记录 C#进阶系列——WebApi 异常处理解决方案 [ASP.NET Web API教程]4.3 AS ...
- weblogic从应用服务器找不到主应用服务器
报错信息: weblogic.cluster.replication.ApplicationUnavailableException: WebApp with contextPath: not fou ...
- mac下多个php版本快速切换的方法是怎么样
一.使用brew安装php多版本方法# brew install php56# brew install php70二.安装切换工具# brew install php-version# source ...
- openlayers 学习笔记一
1. 创建地图,加载控件 var map = new OpenLayers.Map("map", { projection: new OpenLayers.Projection(& ...
- 主线程中创建不同的handler实例,接收消息会不会冲突
http://www.cnblogs.com/transmuse/archive/2011/05/16/2048073.html这篇博文讲的比较透彻,可参考. 当然结论是不会冲突.因为每个messag ...
- java double类型保留两位小数4种方法【转】
4种方法,都是四舍五入,例: import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberF ...