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;
 

If Value Exists Then Query Else Allow Create New in Oracle Forms An Example的更多相关文章

  1. Learn How To Create Trigger In Oracle Forms

    I have written many posts related to triggers in Oracle Forms, I have given examples for Form Level ...

  2. Create Data Block Based On From Clause Query In Oracle Forms

    Example is given below to create a data block based on From Clause query in Oracle Forms. The follow ...

  3. Enter Query Mode Search Tricks Using Enter_Query Built-in in Oracle Forms

    In this post you will learn how to specify any condition in enter query mode of Oracle Forms. Whenev ...

  4. 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 ...

  5. Create Timer Example To Show Image Presentation in Oracle Forms

    Suppose you want to change multiple images after a specified time in home screen of your oracle form ...

  6. Freebie - Utility Form: Generate Excel Report From SQL Query In Oracle Forms 6i And 11g

    Sharing a form to generate Excel file report from SQL query in Oracle Forms. This form can be used i ...

  7. Create Custom Modal Dialog Windows For User Input In Oracle Forms

    An example is given below to how to create a modal dialog window in Oracle Forms for asking user inp ...

  8. Create Stacked Canvas to Scroll Horizontal Tabular Data Blocks In Oracle Forms

    In this tutorial you will learn to create horizontal scrollable tabular or detail data block by usin ...

  9. [Oracle] - Create DB on Oracle 12c for an Application

    Let's say we are going to develop a application for a bank, or any other enterprise, this applicatio ...

随机推荐

  1. Firewall Rule Properties Page: Advanced Tab

    Applies To: Windows 7, Windows Server 2008 R2 Use this tab to configure the profiles and interface t ...

  2. Java资料整理

    Java资料整理 原创 2017年08月25日 17:20:44 14211  1.LocalThread的应用场景,数据传输适合用LocalThread么 2.linux的基本命令    软链接.更 ...

  3. Leetcode 507.完美数

    完美数 对于一个 正整数,如果它和除了它自身以外的所有正因子之和相等,我们称它为"完美数". 给定一个 正整数 n, 如果他是完美数,返回 True,否则返回 False 示例: ...

  4. idea中将项目与github关联

    © 版权声明:本文为博主原创文章,转载请注明出处 1.在github中创建一个账号:https://github.com/join?source=header-home 2.下载并安装git:http ...

  5. [cocos2dx UI] CCLabelAtlas 为什么不显示最后一个字

    CClabelAtlas优点,基本用法等我就不说了,这里说一个和美术配合时的一个坑!就是图片的最后一位怎么也不显示,如下图中的冒号不会显示 查了ASCII码表,这个冒号的值为58,就是在9(57)的后 ...

  6. Vim插件YCM的安装

    YouCompleteMe(YCM)是一款非常好用的Vim插件,但是很多人安装的时候会出问题(尤其是涉及到C和C++的补全),我安装的时候也遇到了问题,现在解决了,给大家参考: Step1: 通过Vu ...

  7. mysql再次安装问题

    安装过一次mysql的电脑,想再安装或更换其它版本的mysql.在重新安装的最后一步,总会出现这样的问题. 网上说法也很多,什么删除注册表了等等.这都是狗屁. 真正的做法是找到C盘下的隐藏文件夹Pro ...

  8. RTSP会话基本流程

    RTSP会话基本流程 RTSP交互流程: C表示RTSP客户端,S表示RTSP服务端 ① C->S: OPTION request //询问S有哪些方法可用 S->C: OPTION re ...

  9. iOS之UITraitCollection

    UITraitCollection 为表征 size class 而生,用来区分设备.你可以在它身上获取到足以区分所有设备的特征. UITraitEnvironment 协议.UIContentCon ...

  10. spoj 8222 NSUBSTR 求长度为x的子串中出现次数最大值 SAM

    题目大意 给一个字符串S 令F(x)表示S的所有长度为x的子串中 出现次数的最大值. 求F(1)..F(Length(S)) 分析 一个节点\(x\)的长度有\(~~(max(fa),max(x)]\ ...