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 ...
随机推荐
- Careercup - Microsoft面试题 - 4639756264669184
2014-05-12 06:42 题目链接 原题: Write your own regular expression parser for following condition: az*b can ...
- 所有 Python 程序员必须要学会的「日志」记录。
本文字数:3840 字 阅读本文大概需要:10 分钟 写在之前 在我们的现实生活中,「日志记录」其实是一件非常重要的事情,比如银行的转账记录,汽车的行车记录仪记录行驶过程中的一切,如果出现了什么问题, ...
- 树中两个结点的最低公共祖先--java
题目:对于任意一个树,不仅仅限于二叉树,求树中两个结点的最低公共祖先结点. 解析:对于任意一棵树,显然并不局限于二叉树,也就是说树的非叶子结点可能存在多个子节点.所以,我们可以定义两个链表结构,存储这 ...
- LAMP总四部分
第一部分 1. 安装mysqlcd /usr/local/src/ 免安装编译二进制的包wget http://syslab.comsenz.com/downloads/linux/mysql-5.1 ...
- [luogu_P1251][LOJ#6008]「网络流 24 题」餐巾计划
[luogu_P1251][LOJ#6008]「网络流 24 题」餐巾计划 试题描述 一个餐厅在相继的 \(N\) 天里,第 \(i\) 天需要 \(R_i\) 块餐巾 \((i=l,2,-,N)\) ...
- C++ vector 的 begin()、end()、front()、back() 区别
STL中实现源码可见:http://www.cplusplus.com/reference/vector/vector/begin/ 一.begin函数 函数原型: iterator begin(); ...
- hdu 1158 dp
/* 题目大意:给n个月工作需要的人数,雇佣一个需要花hire 每个月的薪水是salary,解雇一个需要fire 求完成所有工作的最小费用 dp(i,j)表示第i个月雇佣j员工的最小费用 */ #in ...
- [CODEVS1205]单词反转
给出一个英语句子,希望你把句子里的单词顺序都翻转过来 这个题算是第二次做了……第二次用的C++然而还是写不出来 思路1:用一个数组把读过去的单词存起来,再逆序输出即可 思路2:读入句子后,先在句子开头 ...
- Activity之启动模式
在Android中每个界面都是一个Activity,切换界面操作其实是多个不同Activity之间的实例化操作.在Android中Activity的启动模式决定了Activity的启动运行方式. Ac ...
- 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---54
以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下: