【发布时间】:2018-11-24 00:53:43
【问题描述】:
我的桌子是这样的:
+-------------------+
|Name |
+-------------------+
|Name1 |
|Name2 |
|Name3 |
|Name4 |
|Name1Jr |
|Name2Jr |
|Name4Jr |
+-------------------+
我的多行块看起来像:
我想知道的是,插入名字后如何插入与Jr同名的记录。例如,我插入了 Name2,它也会将 Name2Jr 插入到多行块中。像这样:
注意:我需要从数据库中获取自动插入数据的值。
我尝试了 WHEN-NEW-RECORD-INSTANCE 触发器(@Littlefoot 爵士对我最后一个问题的回答):
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;
现在,我想知道是否有办法在 WHEN-VALIDATE-RECORD 触发器上执行此操作。问题在于 duplicate_record 不能在 WHEN-VALIDATE-RECORD 触发器中使用。如何使用过程,函数或其他东西来做到这一点?提前致谢!
【问题讨论】:
标签: oracle oracle11g oracleforms