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. [slim] Slim - Faster, lightweight, a enginer for Ruby

    URL: http://slim-lang.com/ Example: doctype html html head title Slim Examples meta name="keywo ...

  2. OpenStack collectd的从零安装服务端

    安装collectd包操作同客户端相同,不在赘述 配置文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 ...

  3. 使用uiautomatorviewer和uiautomator来做android的UI测试

    来自:http://university.utest.com    作者:Angelos Nakulas (All Authored Courses)      译者:Elaine00 目录 简介 什 ...

  4. Android NDK 开发(四)java传递数据到C【转】

    转载请注明出处:http://blog.csdn.net/allen315410/article/details/41845701 前面几篇文章介绍了Android NDK开发的简单概念.常见错误及处 ...

  5. grid

  6. JavaEE基础(十四) /正则

    1.常见对象(正则表达式的概述和简单使用) A:正则表达式 是指一个用来描述或者匹配一系列符合某个语法规则的字符串的单个字符串.其实就是一种规则.有自己特殊的应用. 作用:比如注册邮箱,邮箱有用户名和 ...

  7. 常用的math函数

    <?php    //1.abs — 绝对值                      echo abs(-77);      //ceil — 进一法取整                   ...

  8. Windows 7 驱动开发

    本文是对Win7(64)+VS2010+WDK7.1.0(WinDDK\7600.16385.1)开发驱动的小结. 一.系统工具 1.Win7(amd64位)系统 注:已装系统后,管理员身份运行cmd ...

  9. linux crontab定时执行

    #利用crontab定时执行url研究了两种简单方式#一利用lynx访问url yum install lynxservice crond startcrontab -einsert键* * * * ...

  10. React.js入门小案例

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title&g ...