【问题标题】:Oracle automatically insert record in multirecord blockOracle 自动在多记录块中插入记录
【发布时间】:2018-06-11 14:04:15
【问题描述】:

我的桌子是这样的:

+-------------------+
|Name               |
+-------------------+
|Name1              |
|Name2              |
|Name3              |
|Name1Jr            |
|Name2Jr            |
|Name3Jr            |
+-------------------+

我的多行块看起来像:

我想知道的是,插入名字后如何插入与Jr同名的记录。例如,我插入了 Name2,它也会将 Name2Jr 插入到多行块中。像这样:

我尝试过发布记录触发器:

insert tbl.name into name
from table tbl
where tbl.name = name||'Jr.'

注意:我需要从数据库中获取自动插入数据的值。

【问题讨论】:

    标签: oracle oracle11g oracleforms


    【解决方案1】:

    这是一个选项。

    • 创建数据库块
    • 将其“导航样式”属性设置为“更改记录”
    • 创建块级WHEN-NEW-RECORD-INSTANCE触发器:

      if :system.trigger_record = 1 and :test.name is null then
         -- do nothing if it is the first record in a form
         null;
      else
         duplicate_record;
         if substr(:test.name, -2) = 'Jr' then
            -- you've duplicated a record which already has 'Jr' at the end - don't do it
            :test.name := null;
         else       
            -- concatenate 'Jr' to the duplicated record
            :test.name := :test.name || 'Jr';
         end if;      
      end if;  
      
    • 运行表单

    【讨论】:

      猜你喜欢
      • 2018-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多