【问题标题】:How can i forbid an master-detail insert with no detail in Oracle Forms如何在 Oracle Forms 中禁止没有详细信息的主从插入
【发布时间】:2011-10-06 14:04:03
【问题描述】:

我正在尝试创建一个表示订单的块,并且该块与块 order_itens 具有主从关系。 如果我在 order_itens 中没有任何记录,我需要禁止保存此数据结构。

【问题讨论】:

  • 应该有一个预块程序。

标签: oracle oracleforms


【解决方案1】:

一种方法是使用 POST-FORMS-COMMIT 触发器。这会在所有数据被插入、更新或删除之后但在数据库提交之前触发。所以你可以这样做:

declare
  l_count integer;
begin
  select count(*)
  into l_count
  from detail
  where master_id = :master.master_id
  and rownum = 1;

  if l_count = 0 then
    message ('Must have details');
    raise_application_error;
  end if;
end;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-30
    • 1970-01-01
    • 1970-01-01
    • 2012-03-12
    • 2014-10-26
    • 2019-07-19
    • 1970-01-01
    相关资源
    最近更新 更多