【问题标题】:Oracle form builder , pl/sqlOracle 表单生成器 , pl/sql
【发布时间】:2020-03-31 22:15:46
【问题描述】:

我是 Oracle Forms 的新手,非常感谢您的帮助!

我的 Oracle Forms Builder 中有两个多记录块。让我们将它们命名为 block1block2。 这些块具有相同的三列 - SequenceNameDate

我的目标是 - 按下“更新”按钮后,我需要根据 block1 的更改更新 block2

代码应该比较两个块。如果在block1 中更改了名称或日期(Sequence 无法更改),请在block2 中更新。

如果记录从block1 完全消失,则不要更改block2 中的任何内容,只需转到下一条记录。

如果可以,请告诉我。

谢谢!

【问题讨论】:

    标签: oracle plsql oracleforms


    【解决方案1】:

    这是一个嵌套循环选项。

    由于我没有您的表格(也不想创建表格),我正在使用 Scott 的 DEPT 表格(第一个块的来源,Dept 1)及其副本创建为create table dept2 as select * From dept(这是第二个块的来源,Dept 2)。

    这是布局;我按下“更新”按钮后截取的屏幕截图:

    • 我查询了两个块
    • 然后我更新了第一个块:
      • 对于 deptno = 10,我将 dname 设置为 xxx
      • 对于 deptnon = 30,我将 loc 设置为 yyy
    • 然后我按下了将 xxx 和 yyy 复制到第二个块的按钮

    执行此操作的代码如下所示;在代码中读取 cmets。

    -- go to the second block; navigate to the first record
    go_block('dept2');
    first_record;
    
    loop
      -- this variable contains current cursor position. It will be used later
      -- with GO_RECORD. Why? To avoid indefinite loop
      :global.rec := :system.cursor_record;
    
      -- go to the first block and - in a loop - scroll through all its rows
      go_block('dept1'); 
      first_record;
      loop
        -- if DEPTNO columns match, then update second block's values to first block's.
        -- I don't really care whether they are different or not - I perform update unconditionally
        if :dept2.deptno = :dept1.deptno then
             :dept2.dname := :dept1.dname;
             :dept2.loc   := :dept1.loc;
        end if;
        exit when :system.last_record = 'TRUE';
        next_record;
      end loop;
    
      -- I've done scrolling through the first block. Go to the next row in the second block
      go_block('dept2');
      go_record(:global.rec);
      exit when :system.last_record = 'TRUE';
      next_record;
    end loop;
    

    【讨论】:

      猜你喜欢
      • 2012-04-19
      • 1970-01-01
      • 2010-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-11
      • 1970-01-01
      • 2015-07-02
      相关资源
      最近更新 更多