Why And When To Use Pre-Update and Pre-Insert Triggers In Oracle Forms
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:
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;
Why And When To Use Pre-Update and Pre-Insert Triggers In Oracle Forms的更多相关文章
- Map Columns From Different Tables and Create Insert and Update Statements in Oracle Forms
This is one of my most needed tool to create Insert and Update statements using select or alias from ...
- MySQL update语句和insert插入语句写法完全不一样啊,不要搞混
1.mysql update 语句: update user set name = 'xiaoming',age = 18 where uid = 3000; 更新记录时update操作也不需要写ta ...
- update更新多行数据(oracle)
转自:http://blog.itpub.net/25322446/viewspace-767505 说明:笔记总结了在工作中遇到过的几种update方法和各种方法适用的范围. 1.单表更新方案:使用 ...
- 转 update关联更新在sqlserver和oracle中的实现
sqlserver和oracle中实现update关联更新的语法不同,都可以通过inline view(内嵌视图)来实现,总的来说sqlserver更简单些. 测试例子如下: create table ...
- 存储过程返回update结果集和insert主键
update teacher set name ='111' where id in(286,289);print @@rowcount;--或select将查出,是@@rowcount,不是@row ...
- with as 和update ,Delete,insert
这个SQL写了很久的时间,感觉pgSQL的很是麻烦. with as 先命名一个表出来,就可以当成临时表用. WITH tmp AS ( SELECT MAX(mgi.inner_cd) AS inn ...
- insert失败自动执行update(duplicate先insert)
例如:有一张表 字段有 id主键自增,或者唯一索引:datetime时间 name名字 INSERT INTO TABLE (id,datetime) VALUES (1,1440000000), ...
- mysql 存在update不存在insert
如果在INSERT语句末尾指定了ON DUPLICATE KEY UPDATE,并且插入行后会导致在一个UNIQUE索引或PRIMARY KEY中出现重复值,则在出现重复值的行执行UPDATE:如果不 ...
- MySQL中insert ignore into, on duplicate key update,replace into,insert … select … where not exist的一些用法总结
在MySQL中进行条件插入数据时,可能会用到以下语句,现小结一下.我们先建一个简单的表来作为测试: CREATE TABLE `books` ( `id` ) NOT NULL AUTO_INCREM ...
- [转]Oracle Form 触发器执行顺序
Trigger 不是数据库中的触发器,不过功能类似,都是当某个事件发生的时候会触发. Trigger中可以编写代码,当对应事件发生的时候就会执行该Trigger中的代码. Oracle Form中的T ...
随机推荐
- 【crunch bang】国内源
/etc/apt/sources.list 因为测试需要,装完Debian7 后,更新为163的源,但是后来装软件时,一些软件依赖包还是装不上.后来把163源稍加改动,就好用了.163源内容如下: d ...
- OpenStack 的windows镜像的开启办法
创建虚拟机 使用我们的管理平台的windows主机创建流程,创建一台主机.在vnc中能看到主机进入到系统中 需要点击按钮sendctrl进入输入密码阶段. 输入我们的镜像的默认密码:5@mdjkw 打 ...
- UIActionSheet和UIAlert
UIActionSheet: 首先,在.h文件中添加Protocol,(Protocol相当于Java中的interface) @interface ActionSheetViewController ...
- android 学习随笔十一(网络:HttpClient框架)
1.使用HttpClient框架发送get.post请求 google收集apache提供的一个发送Http请求框架 public class Tools { public static String ...
- hobby
如果把战争的原则凝缩为一个词,那就是集中. 人生有三把钥匙, 接受. 改变. 离开.不能接受,那就改变,不能改变,那就离开. 少问别人为什么,多问自己凭什么. 太平自古将军定,不许将军见太平
- Nagios监控磁盘
1.查看check_disk脚本 [oracle@rhel5 ~]$ /usr/local/nagios/libexec/check_disk --h check_disk v1.) Copyrigh ...
- IOS5基础教程之一-----如何创建XCode项目
一.IOS的基础知识 1.只有一个应用程序正在运行.在IOS上,每一段时间内只能激活一个应用程序并在屏幕上显示. 2.只有一个窗口.只允许应用程序操作的一个窗口. 3.访问受限.只能在IOS为应用程序 ...
- 手机端上传未知图片大小,js设置宽高比例
<style rel="stylesheet" type="text/css"> .lunboimg{ width: 100%; height: a ...
- ACM题目————The Blocks Problem
代码参考:http://www.hankcs.com/program/uva-q101-the-blocks-problem.html Description Background Many area ...
- 【转】Cookie和Session的区别详解
转载地址:http://www.phperzone.cn/portal.php?aid=541&mod=view 一.cookie机制和session机制的区别 具体来说cookie机制采用的 ...