开发者

How can i forbid an master-detail insert with no detail in Oracle Forms

开发者 https://www.devze.com 2023-04-11 09:22 出处:网络
I\'m trying to create a block which represents an order and that block has a master-detail relationship with the block order_itens.

I'm trying to create a block which represents an order and that block has a master-detail relationship with the block order_itens. I 开发者_运维问答need to forbid the saving of this data structure IF i don't have any records in order_itens.


One way is to use a POST-FORMS-COMMIT trigger. This fires after all data has been inserted, updated or deleted but before the database commit. So you can do something like:

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号