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. [php]表单和验证

    <?php /* 表单的作用: 通过表单 发布和收集 信息. 对html表单进行编码 只是有效接受用户输入的必要操作的(一部分), 必须由[服务器端]组件来处理 一 标头函数(header()) ...

  2. yii2的windows下安装及前期步骤

    Yii2的安装(以生成basic目录为例) 第一步:服务器安装好后生成www目录,在该目录下新建yii2目录,把下载的compser.phar包放在该目录下 第二步:dos命令下进入项目目录 第三步: ...

  3. session_start()一些问题

    session问题集锦 对于PHP的session功能,始终找不到合适的答案,尤其是一些错误,还有一些没有错误的结果,最可怕的就是后者,一直为许多的初学者为难.就连有些老手,有时都被搞得莫名其妙.本文 ...

  4. 《OpenGL着色语言》理解点记录三

    “帧缓冲区”中的“帧”的含义?   “帧”是连续图像中的一幅,3D可视化程序最终都是转化为一幅幅的图像输出在显示器上,这一幅幅的图像叫做叫“帧”.   解释“glBlendFunc(GL_SRC_AL ...

  5. imread函数、namedWindow函数、imshow函数、imwrite函数

    1.imread函数 首先,我们看imread函数,可以在OpenCV官方文档中查到其原型如下: Mat imread(const string& filename, int flags=1 ...

  6. viewpager+fragment+HorizontalScrollView详细版

    XML布局 <HorizontalScrollView            android:id="@+id/hsv"            android:layout_ ...

  7. 鸟哥的linux私房菜之磁盘与文件系统管理

    superblock:记录了该文件系统的整体信息包括inode/block的总量,使用量,剩余量以及文件系统的格式与相关信息. inode:记录档案的属性,一个档案占用一个inode,同事记录此档案所 ...

  8. javaWeb 在jsp中 使用自定义标签输出访问者IP

    1.java类,使用简单标签,jsp2.0规范, 继承 SimpleTagSupport public class ViewIpSimpleTag extends SimpleTagSupport { ...

  9. Facebook MyRocks at MariaDB

    Recently my colleague Rasmus Johansson announced that MariaDB is adding support for the Facebook MyR ...

  10. Greenplum迁移到配置不同的GP系统

    要使用gp_restore或gpdbrestore并行恢复操作,恢复的系统必须与备份的系统具有相同的配置(相同数量的Instance).如果想要恢复数据库对象和数据到配置不同的系统(比如系统扩展了更多 ...