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 ...
随机推荐
- HighCharts实现双Y轴
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.c ...
- Leetcode 522.最长特殊序列II
最长特殊序列II 给定字符串列表,你需要从它们中找出最长的特殊序列.最长特殊序列定义如下:该序列为某字符串独有的最长子序列(即不能是其他字符串的子序列). 子序列可以通过删去字符串中的某些字符实现,但 ...
- java课堂 笔记
- ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: Incompatible namespaceIDs
用三台centos操作系统的机器搭建了一个hadoop的分布式集群.启动服务后失败,查看datanode的日志,提示错误:ERROR org.apache.hadoop.hdfs.server.dat ...
- 【距离GDOI:137天】 扩展KMP...字符串QAQ
上次和黄神两人一合计,干脆我学字符串他学图论,然后两人相互教...但以蒟蒻最近这状态来看,估计会到时候也教不了QAQ 扩展KMP大概是下面这个课件讲的这样 http://wenku.baidu.com ...
- id_rsa id_rsa.pub
id_rsa 私钥 id_rsa.pub 公钥 https://blog.csdn.net/qq_36663951/article/details/78749217 https://blog.cs ...
- pat 团体天梯赛 L2-012. 关于堆的判断
L2-012. 关于堆的判断 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 将一系列给定数字顺序插入一个初始为空的小顶堆H[] ...
- HDOJ 1085 Holding Bin-Laden Captive!
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Ja ...
- 模拟浏览器的GET和POST动作
Jakarta的httpclient3.1是最新版本,项目中需要用程序模拟浏览器的GET和POST动作.在使用过程中遇到不少问题.1. 带附件的POST提交 最开始都是使用MultipartPo ...
- android基本控件学习-----ToggleButton&Switch
ToggleButton(开关按钮)和Switch(开关)讲解: 一.核心属性讲解: (1)ToggleButton textOn:按钮被选中的时候文字显示 textOff:按钮没有被选中的时候文字显 ...
