zoukankan      html  css  js  c++  java
  • Copy Records From One Data Block To Another Data Block In Oracle Forms

    In this tutorial you will learn to copy the records from one data block to another data block on same form and on a same canvas in Oracle Forms.

     

    Below is the screen shot of the form and you can download this form for your reference from the following link (Table script is also included):

    Download

    clip_image001


    In the above picture you can see that there are two blocks, first one is the block based on a table and the second one is a non-database data block, but this is not necessary you can make the block based on a table also.

    The functionality of this form is, user will select the record above then click on Copy button to copy the record below, it is like making the selection of records from a data block. User can also remove the records from the second block where the records are being copied.

    The whole functionality is written on the push button Copy and below is the code written on When-Button-Pressed trigger:



    BEGIN

       GO_BLOCK ('COPIED');

       FIRST_RECORD;

     

       LOOP

          -- CHECK THE VALUE IF RECORD IS EMPTY IF NOT THEN JUMP TO ANOTHER

          IF :copied.empno IS NULL

          THEN

             -- EXIT TO COPY THE RECORD

             EXIT;

          END IF;

     

          -- ELSE CONTINUE FINDING EMPTY RECORD

          IF :SYSTEM.LAST_RECORD = 'TRUE'

          THEN

             CREATE_RECORD;

             EXIT;

          END IF;

     

          NEXT_RECORD;

       END LOOP;

     

       -- COPY THE RECORD

       :copied.empno := :scott_emp.empno;

       :copied.ename := :scott_emp.ename;

       :copied.job := :scott_emp.job;

       :copied.mgr := :scott_emp.mgr;

       :copied.hiredate := :scott_emp.hiredate;

       :copied.sal := :scott_emp.sal;

       :copied.comm := :scott_emp.comm;

       :copied.deptno := :scott_emp.deptno;

       -- GO BACK TO FIRST BLOCK

       GO_BLOCK ('SCOTT_EMP');

    END;



    You should replace the value of data block and item reference (:copied.empno := :scott_emp.empno) with your form's data block and items.

    Below is the code of Remove push button of second data block to clear the record when pressed:



    CLEAR_RECORD;



    Just a One line code which is sufficient.

     

  • 相关阅读:
    宝物筛选
    [HAOI2008]糖果传递
    线段树(区间查询,区间修改)——标记永久化版
    图的割边
    图的割点
    P2066 机器分配
    SP1700 TRSTAGE
    P4568 [JLOI2011]飞行路线
    POJ 2533 Longest Ordered Subsequence
    HDU 2512 一卡通大冒险
  • 原文地址:https://www.cnblogs.com/quanweiru/p/6219402.html
Copyright © 2011-2022 走看看