I have a trigger that runs procedures with regards to table a that the trigger is exectued on...This is an After DELETE, INSERT, UPDATE trigger....this trigger calls procedures that inturn update table B based on table A values. As an example, table A (WPOPERATION) has a list of operations (1, 2, 3) that also have corresponding dollar values (100, 200, 300). When I update or insert records in Table A table B is indeed updated based on the values. If I delete one of the rows....let us say (3) the update to table B does not occur. If I goto the form that is linked to table be and refresh it still will not occur. However, if I change any field on the form (table B) the data is then updated. Kind of odd..
I did try and create another trigger that was an After Delete "only" and
AFTER DELETE ON table B
FOR EACH ROW
BEGIN
UPDATE table B
Set fielda = 'N'
Where wonum = '26645';
END;
This worked, but I would need this to update based on the wonum currently be used and also I would really not want to change the data of fielda. So this did not work as I also tried old.fielda etc..
Does anyone have an idea...here is the trigger I have at present...
CREATE OR REPLACE TRIGGER WDW_IFPS_WOOPS_STATEMENT
AFTER DELETE OR INSERT OR UPDATE
ON WPOPERATION
REFERENCING NEW AS NEW OLD AS OLD
declare
-- this trigger calls the procedure
-- to update the true cap and exp totals (includes inflation and
-- contingency values) stored on the WOX table for a workorder
-- wonums are saved off in an array in the
-- row level trigger
--chg to add 2 new out parameters for
-- budget cap and budget exp which now are calced to include inflation
ln_wonum_cnt number default 0;
ls_wonum maximo.workorder.wonum%TYPE;
cnt number default 0;
li_count number default 0;
ln_captotal number default 0;
ln_exptotal number default 0;
ln_de_cap number default 0;
ln_pm_cap number default 0;
ln_pfc_cap number default 0;
ln_fam_cap number default 0;
ln_de_exp number default 0;
ln_pm_exp number default 0;
ln_pfc_exp number default 0;
ln_fam_exp number default 0;
ln_budget_exp number default 0;
ln_budget_cap number default 0;
begin
ln_wonum_cnt := wdw_wo_data.get_wo_cnt;
for cnt in 1..ln_wonum_cnt loop
ls_wonum := wdw_wo_data.get_wonum(cnt);
select count(*) into li_count
from wox
where wonum = ls_wonum;
if li_count > 0 then
-- NOTE: OUT parameters are not used but are required
-- in these calls: IN parameters are not required
Wdw_Wox_Captotal_Update(p_wonum=>ls_wonum,
p_de_cap=> ln_de_cap,
p_pm_cap=> ln_pm_cap,
p_pfc_cap=> ln_pfc_cap,
p_fam_cap=> ln_fam_cap,
p_captotal=> ln_captotal,
p_budgetcap=> ln_budget_cap);
Wdw_Wox_Exptotal_Update(p_wonum=>ls_wonum,
p_de_exp=> ln_de_exp,
p_pm_exp=> ln_pm_exp,
p_pfc_exp=> ln_pfc_exp,
p_fam_exp=> ln_fam_exp,
p_exptotal=> ln_exptotal,
p_budgetexp=> ln_budget_exp);
end if;
end loop;
maximo.wdw_wo_data.reset_wonum_list;
EXCEPTION
WHEN others then
wdw_wo_data.reset_wonum_list;
RAISE_APPLICATION_ERROR
(-20001, 'Error-' || sqlcode) ;
end ;
I did try and create another trigger that was an After Delete "only" and
AFTER DELETE ON table B
FOR EACH ROW
BEGIN
UPDATE table B
Set fielda = 'N'
Where wonum = '26645';
END;
This worked, but I would need this to update based on the wonum currently be used and also I would really not want to change the data of fielda. So this did not work as I also tried old.fielda etc..
Does anyone have an idea...here is the trigger I have at present...
CREATE OR REPLACE TRIGGER WDW_IFPS_WOOPS_STATEMENT
AFTER DELETE OR INSERT OR UPDATE
ON WPOPERATION
REFERENCING NEW AS NEW OLD AS OLD
declare
-- this trigger calls the procedure
-- to update the true cap and exp totals (includes inflation and
-- contingency values) stored on the WOX table for a workorder
-- wonums are saved off in an array in the
-- row level trigger
--chg to add 2 new out parameters for
-- budget cap and budget exp which now are calced to include inflation
ln_wonum_cnt number default 0;
ls_wonum maximo.workorder.wonum%TYPE;
cnt number default 0;
li_count number default 0;
ln_captotal number default 0;
ln_exptotal number default 0;
ln_de_cap number default 0;
ln_pm_cap number default 0;
ln_pfc_cap number default 0;
ln_fam_cap number default 0;
ln_de_exp number default 0;
ln_pm_exp number default 0;
ln_pfc_exp number default 0;
ln_fam_exp number default 0;
ln_budget_exp number default 0;
ln_budget_cap number default 0;
begin
ln_wonum_cnt := wdw_wo_data.get_wo_cnt;
for cnt in 1..ln_wonum_cnt loop
ls_wonum := wdw_wo_data.get_wonum(cnt);
select count(*) into li_count
from wox
where wonum = ls_wonum;
if li_count > 0 then
-- NOTE: OUT parameters are not used but are required
-- in these calls: IN parameters are not required
Wdw_Wox_Captotal_Update(p_wonum=>ls_wonum,
p_de_cap=> ln_de_cap,
p_pm_cap=> ln_pm_cap,
p_pfc_cap=> ln_pfc_cap,
p_fam_cap=> ln_fam_cap,
p_captotal=> ln_captotal,
p_budgetcap=> ln_budget_cap);
Wdw_Wox_Exptotal_Update(p_wonum=>ls_wonum,
p_de_exp=> ln_de_exp,
p_pm_exp=> ln_pm_exp,
p_pfc_exp=> ln_pfc_exp,
p_fam_exp=> ln_fam_exp,
p_exptotal=> ln_exptotal,
p_budgetexp=> ln_budget_exp);
end if;
end loop;
maximo.wdw_wo_data.reset_wonum_list;
EXCEPTION
WHEN others then
wdw_wo_data.reset_wonum_list;
RAISE_APPLICATION_ERROR
(-20001, 'Error-' || sqlcode) ;
end ;