create or replace trigger XX_WIP_QTY_CEIL_round
before insert or update on WIP_REQUIREMENT_OPERATIONS
referencing new as new old as old
for each row
when (NEW.quantity_issued = 0 and NEW.operation_seq_num > 0 and new.required_quantity is not null)
declare
l_start_qty number;
l_uom_flag varchar2(100); --判断是否为数量单位
uom_code varchar2(5);
begin
select count('X'),primary_uom_code
into l_uom_flag,uom_code
from mtl_system_items_b
where inventory_item_id = :new.inventory_item_id
and organization_id = :new.organization_id
and primary_uom_code in ('PCS', 'EA','KG');
if (l_uom_flag = 1 ) then
if uom_code in ('PCS','EA') then
begin
select nvl(start_quantity, 0)
into l_start_qty
from wip_discrete_jobs
where organization_id = :new.organization_id
and wip_entity_id = :new.wip_entity_id;
exception
when others then
null;
end;
:new.required_quantity := ceil(:new.required_quantity);
if l_start_qty != 0 then :new.quantity_per_assembly := ceil(:new.required_quantity)/
l_start_qty;
end if;
elsif ( uom_code='KG') then
begin
select nvl(start_quantity, 0)
into l_start_qty
from wip_discrete_jobs
where organization_id = :new.organization_id
and wip_entity_id = :new.wip_entity_id;
exception
when others then
null;
end;
:new.required_quantity := round(:new.required_quantity,3);
if l_start_qty != 0 then :new.quantity_per_assembly := round(:new.required_quantity,3) /
l_start_qty;
end if;
end if;
if :new.mrp_net_flag = 1 then
:new.mps_required_quantity := :new.required_quantity;
end if;
end if;
end;ORA-06512:在"APPS.XX_WIP_QTY_CEIL_ROUND",LINE 6
ORA-04088:触发器"APPS.XX_WIP_QTY_CEIL_ROUND"执行过程中出错我的触发器要怎么修改呢。
before insert or update on WIP_REQUIREMENT_OPERATIONS
referencing new as new old as old
for each row
when (NEW.quantity_issued = 0 and NEW.operation_seq_num > 0 and new.required_quantity is not null)
declare
l_start_qty number;
l_uom_flag varchar2(100); --判断是否为数量单位
uom_code varchar2(5);
begin
select count('X'),primary_uom_code
into l_uom_flag,uom_code
from mtl_system_items_b
where inventory_item_id = :new.inventory_item_id
and organization_id = :new.organization_id
and primary_uom_code in ('PCS', 'EA','KG');
if (l_uom_flag = 1 ) then
if uom_code in ('PCS','EA') then
begin
select nvl(start_quantity, 0)
into l_start_qty
from wip_discrete_jobs
where organization_id = :new.organization_id
and wip_entity_id = :new.wip_entity_id;
exception
when others then
null;
end;
:new.required_quantity := ceil(:new.required_quantity);
if l_start_qty != 0 then :new.quantity_per_assembly := ceil(:new.required_quantity)/
l_start_qty;
end if;
elsif ( uom_code='KG') then
begin
select nvl(start_quantity, 0)
into l_start_qty
from wip_discrete_jobs
where organization_id = :new.organization_id
and wip_entity_id = :new.wip_entity_id;
exception
when others then
null;
end;
:new.required_quantity := round(:new.required_quantity,3);
if l_start_qty != 0 then :new.quantity_per_assembly := round(:new.required_quantity,3) /
l_start_qty;
end if;
end if;
if :new.mrp_net_flag = 1 then
:new.mps_required_quantity := :new.required_quantity;
end if;
end if;
end;ORA-06512:在"APPS.XX_WIP_QTY_CEIL_ROUND",LINE 6
ORA-04088:触发器"APPS.XX_WIP_QTY_CEIL_ROUND"执行过程中出错我的触发器要怎么修改呢。
我觉得你还是一截一截的调试,不要把所有的功能多写全了再调试,
等第一个功能完成了,然后再一点一点的添加...