Suppose you want to populate a non-database data block with records manually in Oracle forms. This task can be done using a cursor.
 
Below is the example given for hr.job_history table, where user input the employee id in upper block and click on the fetch button to populate the records from hr.job_history table into the lower tabular data block.
 
The following is the screen shot for this example: (you can also download the form from this link Job_History.fmb)
Follow to get notifications for free source code in future, thanks.
 
For the employee id field of upper block write the When-Validate-Item trigger code as below:
 
Begin
Select first_name||' '||last_name into :ctrl.ename from hr.employees
   where employee_id = :ctrl.empid;
exception
when no_data_found then
    message('Employee id does not exists');
    raise form_trigger_failure;
End;
 

For the Fetch button write the When-Button-Pressed trigger code as below:

Declare
Cursor C_jobs
  is
  Select employee_id, start_date, end_date,
         job_id, department_id
         from hr.job_history
         where employee_id = :ctrl.empid;
Begin
go_block('job_history');
-- first clear the block if it contains any records
clear_block(no_validate);
-- move control to first record;
first_record;
        -- open the cursor and populate the block
for cur in C_jobs loop
 :job_history.employee_id := cur.employee_id;
 :job_history.start_date := cur.start_date;
 :job_history.end_date := cur.end_date;
 :job_history.job_id := cur.job_id;
 :job_history.department_id := cur.department_id;
 -- move control to next record;
 next_record;
end loop;
-- again after completion move control to first record
first_record;

End;

See also: If Value exists then query else create new in Oracle Forms

Follow To Get Notifications For Free Source Code

Populating Tabular Data Block Manually Using Cursor in Oracle Forms的更多相关文章

  1. Determining Current Block and Current Item in Oracle Forms

    SYSTEM.CURSOR_BLOCK Determining current block in Oracle Forms Using SYSTEM.CURSOR_BLOCK system varia ...

  2. Define Custom Data Filter Using Pre-Query Trigger In Oracle Forms

    Oracle Forms is having its default records filter, which we can use through Enter Query mode to spec ...

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

  4. oracle --(一)数据块(data Block)

    基本关系:数据库---表空间---数据段---分区---数据块 数据块(data Block)一.数据块Block是Oracle存储数据信息的最小单位.这里说的是Oracle环境下的最小单位.Orac ...

  5. Writing Text File From A Tabular Block In Oracle Forms

    The example given below for writing text file or CSV using Text_IO package from a tabular block in O ...

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

  7. Data Block Compression

    The database can use table compression to eliminate duplicate values in a data block. This section d ...

  8. How To Commit Just One Data Block Changes In Oracle Forms

    You have an Oracle Form in which you have multiple data blocks and requirement is to commit just one ...

  9. ORA-01578 data block corrupted 数据文件损坏 与 修复 (多为借鉴 linux)

    好吧,先说说造成崩溃的原因: 使用redhat 5.9 Linux 作为数据库服务器, 周五数据库正在使用中,硬关机造成数据库文件部分损坏(周一上班时,应用程序启动不起来,查看日志文件时,发现一个数据 ...

随机推荐

  1. 如何设置DB2I(SPUFI)来正常工作

    首先确定你现在所使用的登录proc,确保有权限可以在对应的PDS内新建member,可以在s.st里面找userid对应的job,然后去serach using,基本可以找到对应的dataset 用t ...

  2. StringTokenizer类

    StringTokenizer是一个用来分隔String字符串的应用类. 1.构造函数 public StringTokenizer(String str)  //构造一个用来解析str的String ...

  3. ffmpeg无法接收组播流问题处理

    问题:ffmpeg无法对IP组播进行处理,表现如下 [root@os01 /]# ffprobe udp://225.0.0.2:9000 ffprobe version Copyright (c) ...

  4. 对于改善 MySQL 数据装载操作有效率的方法是怎样

    多时候关心的是优化SELECT 查询,因为它们是最常用的查询,而且确定怎样优化它们并不总是直截了当.相对来说,将数据装入数据库是直截了当的.然而,也存在可用来改善数据装载操作效率的策略,其基本原理如下 ...

  5. 霸气的jQ插件

    http://codepen.io/ canvas的各种实例 1.The Responsive jQuery Content Slider http://bxslider.com/ 2.ThemePu ...

  6. python中列表和字典常用方法和函数

    Python列表函数&方法 Python包含以下函数: 序号 函数 1 cmp(list1, list2)比较两个列表的元素 2 len(list)列表元素个数 3 max(list)返回列表 ...

  7. YTU 2986: 删除区间内的元素(线性表)

    2986: 删除区间内的元素(线性表) 时间限制: 1 Sec  内存限制: 2 MB 提交: 8  解决: 3 题目描述 若一个线性表L采用顺序存储结构,其中元素都为整数.设计一个算法,删除元素值在 ...

  8. JAVA基础知识之多线程——三种实现多线程的方法及区别

    所有JAVA线程都必须是Thread或其子类的实例. 继承Thread类创建线程 步骤如下, 定义Thead子类并实现run()方法,run()是线程执行体 创建此子类实例对象,即创建了线程对象 调用 ...

  9. UVa(12821),MCMF

    题目链接:https://uva.onlinejudge.org/external/128/12821.pdf 比赛的时候,准备用最短路来做,存两张图,做两次最短路,本来还觉得第二张图的设计很好的,很 ...

  10. vilte/vowifi

    vendor/mediatek/proprietary/packages/services/Ims/src/com/mediatek/ims/ImsService.java ¦ ¦ ¦ ¦ ¦ ¦ v ...