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 ...
随机推荐
- Three Steps to Migrate Group Policy Between Active Directory Domains or Forests Using PowerShell
Three Steps Ahead Have you ever wished that you had three legs? Imagine how much faster you could ru ...
- python 类中__init__,__new__,__class__的使用详解
1.python中所有类默认继承object类,而object类提供了很多原始的内置属性和方法,所有用户定义的类在python 中也会继承这些内置属性.我们可以通过dir()进行查看.虽然python ...
- web访问流程
客户端发送请求—->httpd得到请求—->httpd解析请求的格式(html,css,jsp)—->请求相应的PHP解析—->PHP解析程序执行完毕—–>db(数据库) ...
- Spring框架配置beans.xml扩展
Spring学习笔记(二) 续Spring 学习笔记(一)之后,对Spring框架XML的操作进行整理 1 什么是IOC(DI) IOC = inversion of control 控制反转 D ...
- Summary—【base】(JavaScript)
1.认识Js 1.1 Js就是一门运行在客户端浏览器的脚本编程语言 1.2 组成 ECMAScript:Js的语法标准 DOM:JS操作网页 ...
- CodeForces Round #515 DIv.3 F. Yet another 2D Walking
http://codeforces.com/contest/1066/problem/F Maksim walks on a Cartesian plane. Initially, he stands ...
- POJ 2836:Rectangular Covering(状态压缩DP)
题目大意:在一个平面内有若干个点,要求用一些矩形覆盖它们,一个矩形至少覆盖两个点,可以相互重叠,求矩形最小总面积. 分析: 数据很小,很容易想到状压DP,我们把点是否被覆盖用0,1表示然后放在一起得到 ...
- win7删除一个空白文件夹总是显示:“找不到该项目,该项目不在E盘中,请确认该项目的位置,重试”的解决办法
把下面的代码复制粘贴到一新建的txt记事本文档中,并另存为del.bat文件(或者你喜欢的名字),注意扩展名为批处理文件bat: DEL /F /A /Q \\?\%1 RD /S ...
- 【Luogu】P2468粟粟的书架(主席树+前缀和)
题目链接 我仿佛中了个爆零debuff 本题分成两部分,五十分用前缀和,f[i][j][k]表示(1,1)到(i,j)的矩形大于等于k的有多少个数(再记录页数和),查询时二分,另外的用主席树,类似方法 ...
- mysql数据库无法插入中文字符
分析原因:这是因为之前修改了数据库的编码,但数据表的编码却没有跟着改变导致的. 安装mysql 时,使用的是latin编码(随后修改为utf8).建的数据表是在latin编码下建立的.而jsp页面使用 ...
