An example given below for Oracle Forms, when a value exists then execute query for that value to display the correspondent record else allow user to create a new record for that value.

The following is the example given for HR schema employee table, in this example user will enter an empoyee id and if the employee id exists it will query the record else allow user to create a new record, the trigger written on key-next-item trigger, you can download the employees.fmb form also from the following link employees.fmb

KEY-NEXT-ITEM trigger code

declare
v_empid employees.employee_id%type;
Begin
  Select employee_id into v_empid
     from hr.employees
     where employee_id = :employees.employee_id;
     -- value exists
     -- set block property and execute query
     clear_block(no_validate);
   
     set_block_property('employees', default_where, 'employee_id = '||v_empid);
     execute_query;
     set_block_property('employees', default_where, '');
     next_item;
exception
when no_data_found then
   -- when not then clear block and allow to add new
   v_empid := :employees.employee_id;
   clear_block(no_validate);
   :employees.employee_id := v_empid;
   next_item;
End;
 

最新文章

  1. OstrichNet 简易统计信息收集工具
  2. Qt4.8.5在ARM9上的移植
  3. 16个基本颜色关键字 Basic color keywords
  4. Eclipse构建Maven项目
  5. 销售 >> 当今社会生产力最大的源泉为 >>自助服务 与推销员随之消失
  6. 转——Android应用开发性能优化完全分析
  7. asp.net跨域上传文件
  8. Python Open Flash Chart (pyOFC2) — Home
  9. js中退出语句break,continue和return 比较(转)
  10. Omi框架Store体系的前世今生
  11. mysql常用的hint
  12. Spark技术内幕: Shuffle详解(一)
  13. 【转载】 Sqlserver中通过Select Into语句快速单表备份
  14. Oracle 正则表达式 分割字符串
  15. maven 发布快照版本后的引用
  16. 可遇不可求的Question之INSERT … ON DUPLICATE KEY UPDATE 语法篇
  17. Python——pandas读取JSON数据,xml,html数据(python programming)
  18. uva 10918 - Tri Tiling(规律)
  19. 51nod 贪心算法题集
  20. Zepto常见问题

热门文章

  1. Asp.net自定义控件开发任我行(1)-笑傲江湖
  2. C# 中的 #region 和 #endregion 的作用
  3. Wordpress 通过 post id 获取文章 url
  4. HDU3977 Evil teacher 求fib数列模p的最小循环节
  5. jsp运行机制
  6. ftp下出现“当前的安全设置不允许从该位置下载文件”提示
  7. 使用CoreLocation进行定位(Swift版)
  8. 编写可移植的PHP代码
  9. 【SPOJ1297】Palindrome (SA+RMQ)
  10. bzoj2115【WC2011】XOR