Oracle Form's Trigger Tutorial With Sample FMB
Created an Oracle Form to handle specific events / triggers like When-New-Form-Instance, Pre-Insert, Post-Insert, Pre-Update, Post-Update, Post-Query and Post-Forms-Commit.
I am doing the following simple tasks on these events to give you an example:
When-New-Form-Instance Trigger
Picking up Oracle Session ID through USERENV function and User to display below the title of the form, the following is the code written:
BEGIN
SELECT 'ORACLE SESSION ID: '
|| USERENV ('SESSIONID')
|| ' USER NAME: '
|| USER
INTO :VAL_FORM_INSTANCE
FROM DUAL;
END;
Post-Query Trigger
Populating the Department Name.
BEGIN
SELECT department_name
INTO :scott_emp.dptname
FROM dept
WHERE department_id = :scott_emp.deptno;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
Pre-Insert Trigger
Checking if the Hiredate is current date or not.
BEGIN
IF :SCOTT_emp.HIREDATE <> TRUNC (SYSDATE)
THEN
:VAL_PRE_INSERT := 'Hire Date must be current date.';
RAISE form_trigger_failure;
END IF;
-- else ok
:VAL_PRE_INSERT := 'Hire Date is valid.';
END;
Post-Insert Trigger
Counting total number of employees in table.
BEGIN
SELECT 'Employee Count After: ' || COUNT ( * )
INTO :val_pOST_insert
FROM scott_emp;
END;
Pre-Update Trigger
Checking if current day is Sunday then stopping the user the update the record.
BEGIN
IF TO_CHAR (SYSDATE, 'DAY') = 'SUN'
THEN
:VAL_PRE_UPDATE := 'Update is not allowed on Sundays';
RAISE form_trigger_failure;
END IF;
:VAL_PRE_UPDATE := 'Update is allowed today.';
END;
Post-Update Trigger
Just giving a simple message.
BEGIN
:VAL_POST_UPDATE := 'You updated ' || :scott_emp.ename || '''s record.';
END;
Post-Forms-Commit Trigger
Displaying Date and Time of Last Commit
BEGIN
:VAL_POST_COMMIT :=
'Last Commit executed on '
|| TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS');
END;
The following is the screen shot of this form and source code(Table's Script and FMB file) can be download from the following link: Form_Triggers.Zip
Oracle Form's Trigger Tutorial With Sample FMB的更多相关文章
- [转]Oracle Form 触发器执行顺序
Trigger 不是数据库中的触发器,不过功能类似,都是当某个事件发生的时候会触发. Trigger中可以编写代码,当对应事件发生的时候就会执行该Trigger中的代码. Oracle Form中的T ...
- Standard Attachments in Oracle Form 标准附件
Standard Attachments in Oracle Form 默认情况下"附件"按钮是灰色的,本文将展示如何让某个Form的附件按钮变亮,并能上传附件. 以用户Form为 ...
- [Form Builder]Oracle Form系统变量中文版总结大全
转:http://yedward.net/?id=57 Form中的系统变量,它存在于一个Form的整个运行时期的会话之中,变量包含了有关Form相关属性的字节信息.有些变量标明了当前状态,还有些变量 ...
- oracle form 触发器执行顺序及键定义[Z]
1当打开FORM时: (1)PRE-FORM (2)PRE-BLOCK(BLOCK级) (3)WHEN-NEW-FORM-INSTANCE (4)WHEN-NEW-BLOCK-INSTANCE (5) ...
- Oracle Form Builder
Oracle Form Builder 是Oracle的一个开发工具,可以针对Oracle公司的E-Business Suit的ERP系统开发的.对应的还有reports builder. Oracl ...
- Oracle Form Data Entry Sample
I shared a data entry example form here in this post for Oracle Forms beginner developers, so that t ...
- 转: Oracle Form 中commit 与do_key('commit_form')区别
1.commit_form针对form上面的数据变动进行commit,对于代码中的类似update,insert语句也进行提交:如果form上面的数据变动和代码中的数据变动有冲突,最后以界面上的为准. ...
- FRM-10001, FRM-10002, FRM-10003 Oracle Form Builder Error Solution
These errors occurred usually due to forms connection problem or some internal problem, the solution ...
- Oracle Form属性、内置子程序、触发器、系统变量简要
一.属性 1.1 通用属性 名称(Name) 子类信息(Subclass Information) 备注(Comments) 标题(Title) 方向(Direction) 字体名称(Font Nam ...
随机推荐
- 误删除pycharm项目中的文件,如何恢复?
如果写代码的时候,不小心删除来某个文件夹或者文件,而且删除后回收站也找不到, 可以使用如下方法恢复: 选择 Local History -> Show History : 选中需要reset到的 ...
- 实战小项目之嵌入式linux图像采集与传输
项目简介 本次编程实战主要是围绕嵌入式linux v4l2采集框架展开,包括以下几个部分: v4l2视频采集 IPU转码 framebuffer显示 自定义UDP简单协议进行传输 上位机软件 ...
- centos7下使用git
问:为什么需要版本控制系统?[转:http://www.cnblogs.com/shenliang123/p/3824383.html] 版本控制是一种记录若干文件内容变化,以便将来查阅特定版本修订情 ...
- 软件包管理rpm_yum
和文本相关的命令cat 正向显示文本tac 反向显示文本more 可以一步一步显示文本文件less 还可以往上看.几个快捷键:j(往下看), k (往上看), g(定位最上), G(定位最下), ct ...
- Zabbix整合MegaCLI实现物理硬盘的自动发现和监控
MegaCLI是LSI提供的用户空间管理RAID卡(LSI芯片)工具,适用于大多数的Dell服务器. MegaCLI介绍: http://zh.community.dell.com/techcente ...
- 编写可移植的PHP代码
1. 保持配置集中放置. 作为一个通用的准则,建议将大多数信息保存在一个位置(可能是一个文件中),这样在需要修改信息时,就能在同一个位置进行所有必要的修改. 2. 编写可重用的代码: 如果刚刚结束了其 ...
- BZOJ-3190 [JLOI2013]赛车
转成二元一次不等式组,然后半平面交. #include <cstdlib> #include <cstdio> #include <cmath> #include ...
- Hibernate逆向工程生成代码
编辑此文章,其目的是方便以后根据表生成相应的代码,然而并非所有的代码都是如此.这里的Hibernate 即响应题目的ssh框架中的“h”. 如图所示,点击右上角,在myeclipse之中.再点击Mye ...
- 星际竞速(bzoj 1927)
Description 10年一度的银河系赛车大赛又要开始了.作为全银河最盛大的活动之一,夺得这个项目的冠军无疑是很多人的梦想,来自杰森座α星的悠悠也是其中之一.赛车大赛的赛场由N颗行星和M条双向星际 ...
- windows 加入域
点击computer,右击选system ,点 change setting,填写domain和computer-name 加入域,下次登陆加入,在域中会检查computer name
