博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Why And When To Use Pre-Update and Pre-Insert Triggers In Oracle Forms
阅读量:5147 次
发布时间:2019-06-13

本文共 1633 字,大约阅读时间需要 5 分钟。

Whenever we commit after entering data in Oracle Forms, many triggers fires during this event and also 
 fires just before inserting or updating the record into table. We can write Pre-Update and Pre-Insert triggers on particular block to just allow the process or to stop the process by using "Raise Form_Trigger_Failure" command, the following are the some examples:
 
Suppose you have a data block and there is a field which need to be validate just before inserting the record, then you must write the Pre-Insert trigger for this purpose, below is an example:
 
Declare
v_avl_qty number;
Begin
   Select avl_qty into v_avl_qty
     From stock_inhand
    Where Item_Code = :Block1.item_code;
if v_avl_qty < :Block1.qty_issued then
Raise Form_Trigger_Failure;
--- Execution stopped...
end if;
--- Else insertion will take place...
End;
And now I am giving you another example, suppose there is a field which need to be assigned from database just before the updation of the record, then you must write a Pre-Update trigger for this purpose, below is an example:
Declare
   v_value varchar2(10);
Begin
   Select a_value into v_value
     From a_table
    Where b_value = :Block1.b_value;
--- Assign this value to block item
:Block1.a_value := v_value;
--- you can assign any others value to any field just before updation or insertion like:
:Block1.create_date := Sysdate;
Exception
  when others then
     --- After any error or no data found you still want to continue then you can use only Null; statement
     Null;
     --- and any other value to any field you can still assign
:Block1.create_date := Sysdate;
End;
See also:

转载于:https://www.cnblogs.com/quanweiru/p/6220222.html

你可能感兴趣的文章
STL源代码分析--萃取编程(traits)技术的实现
查看>>
用asp.net2.0做的网页,访问时出现 无法显示 XML 页 等错误
查看>>
[HAOI 2015]按位或
查看>>
vsftp 虚拟用户
查看>>
pahlcon:cookies设置
查看>>
使用Spire.Barcode程序库生成二维码
查看>>
对于@Component注解的理解
查看>>
Java学习之Math类理解
查看>>
logstash异常
查看>>
JavaMail实现邮箱之间发送邮件功能
查看>>
关键字和标识符
查看>>
java并发编程(十四)同步问题的内存可见性
查看>>
ASP.NET VS2013 Office 转 PDF
查看>>
C#图解教程 第八章 表达式和运算符
查看>>
CentOS下mysql安装和配置
查看>>
5分钟安装 关于win10安装composer PHP 用来管理依赖(dependency)关系的工具
查看>>
webstorm 文件历史找回~ 恢复正确状态~
查看>>
jsp模板
查看>>
openflow1.5
查看>>
斐波纳契数列
查看>>