DECLARE
CURSOR stage IS
SELECT *
FROM staging_suppresion_table
where flag is null;
l_stat varchar2(100);
l_count number;
l_data varchar2(100);
v_stat varchar2(1) := 'S';
v_parent_association_id number;
v_child_association_id number;
BEGIN
FOR i IN stage LOOP
select activity_association_id
into v_parent_association_id
from mtl_eam_asset_activities
where asset_activity_id=i.parent_activity_id;
select activity_association_id
into v_child_association_id
from mtl_eam_asset_activities
where asset_activity_id=i.child_activity_id;
EAM_ActivitySupn_PUB.INSERT_ACTIVITYSUPN
(
p_api_version => 1.0
, x_return_status => l_stat
, x_msg_count => l_count
, x_msg_data => l_data
, p_parent_association_id => v_parent_association_id
, p_child_association_id => v_child_association_id
, p_tmpl_flag => 'N'
);
update staging_suppresion_table
set flag=l_stat,
note=substr(l_data,5,length(l_data))
where parent_activity_id=i.parent_activity_id
and child_activity_id=i.child_activity_id;
commit;
END LOOP;
IF v_stat <> 'E' THEN
COMMIT;
END IF;
END;