How can i forbid an master-detail insert with no detail in Oracle Forms
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;
精彩评论