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. HTML5,添加图片

    <img src="0.jpg" width="100"  height="150" alt="11">

  2. 一个fork()系统调用的问题

    转载:http://coolshell.cn/articles/7965.html 题目:请问下面的程序一共输出多少个“-”? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...

  3. oracle中dual表的使用

    dual表是一个虚拟表,用来和select语句一起使用.1.查看当前用户select  user from dual2.用来调用系统函数select to_char(sysdate,'yyyy-mm- ...

  4. 关于undefined reference to `WSASocketA@24'问题的解决

    关于 Eclipse 开发C++ Socket  ,在开发的过程中 用WinGW 平台编译, 示例server端: #include <winsock2.h> #include <m ...

  5. 160920、springmvc上传图片不生成临时文件

    springMVC上传图片时候小于10k不会再临时目录里面生成临时文件,需要增加一个配置 <property name="maxInMemorySize" value=&qu ...

  6. Android 常用工具类之DeviceInfoUtil

    public class DeviceInfoUtil { private static WifiManager wifiManager = null; // wifi是否已连接 public sta ...

  7. android log机制——输出log【转】

    转自:http://blog.csdn.net/tdstds/article/details/19084327 目录(?)[-] 在android Java code中输出log Logprintln ...

  8. 坑爹的VS2012

    2.2.2.如果卸载 Visual Studio 2010 Service Pack 1,则必须先重新安装 Visual Studio 2010,然后才能再次安装 SP1 如果卸载 Visual St ...

  9. bodybuilding

    增大肌肉块的14大秘诀:大重量.低次数.多组数.长位移.慢速度.高密度.念动一致.顶峰收缩.持续紧张.组间放松.多练大肌群.训练后进食蛋白质.休息48小时.宁轻勿假. 1. 大重量.低次数:健美理论中 ...

  10. centos6.5-64bit安装htop

    首先启用 EPEL Repository: yum -y install epel-release 启用 EPEL Repository 後, 可以用 yum 直接安裝 Htop: yum -y in ...