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. zw版_zw中文增强版Halcon官方Delphi例程

    [<zw版·delphi与halcon系列原创教程>zw版_zw中文增强版Halcon官方Delphi例程 源码下载:http://files.cnblogs.com/files/ziwa ...

  2. Spring+SpringMVC+MyBatis)

    用SSM(Spring.SpringMVC和Mybatis)已经有三个多月了,项目在技术上已经没有什么难点了,基于现有的技术就可以实现想要的功能,当然肯定有很多可以改进的地方.之前没有记录SSM整合的 ...

  3. OpenStack 物理资源问题

    Contents [hide] 1 写在前面 2 openstack的自有设置 3 解决办法 4 最终解决办法 写在前面 物理CPU核数为12,能虚拟多少虚拟核的机器?openstack的默认使用no ...

  4. The reference to entity “idNo” must end with the ';' delimiter 异常处理

    解决方案很简单,就是把配置项值中用到"&"的地方改成"&".原因是sax解析的类库在读取文件的时候是根据转义后的格式进行读取的,遇到" ...

  5. webservice cxf error:类的两个属性具有相同名称 "password"

    execption detail: Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.Servic ...

  6. Git的搭建和使用技巧完整精华版

    [Git使用技巧] 1.把一个已经存在于版本库中的文件加入忽略提交文件(.gitignore)中,需要如下代码: git rm --cached [文件路径] 例如: git rm --cached  ...

  7. Mysql ibdata 丢失或损坏如何通过frm&ibd 恢复数据

    mysql存储在磁盘中,各种天灾人祸都会导致数据丢失.大公司的时候我们常常需要做好数据冷热备,对于小公司来说要做好所有数据备份需要支出大量的成本,很多公司也是不现实的.万一还没有做好备份,数据被误删除 ...

  8. hdwiki 学习笔记 01

    一.href =“”里的参数写法 <!--{if $hotname[url]}-->{$hotname[url]} <!--{else}-->index.php?doc-inn ...

  9. Uva 11754 Code Feat

    题意概述: 有一个正整数$N$满足$C$个条件,每个条件都形如“它除以$X$的余数在集合$\{Y_1, Y_2, ..., Y_k\}$中”,所有条件中的$X$两两互质, 你的任务是找出最小的S个解. ...

  10. Safecracker 分类: HDU 搜索 2015-06-25 21:12 12人阅读 评论(0) 收藏

    Safecracker Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...