Triggers
Posted in 1994
Hello, I am having a really strange time with some values in a column not being updated properly. This column is updated through several programs, and whenever I watch it carefully and run these programs through the debugger, etc, it works fine. But sometimes the values get completely wrong figures. I've put a trigger on this table to see if I can catch any trends for this, but it seems that the trigger isn't catching these occurances either. Here is the trigger. create trigger "afc".update_res update of ps_res on "afc".itemstat referencing old as old_itemstat new as new_itemstat for each row when ((old_itemstat.ps_res != new_itemstat.ps_res ) ) ( insert into "pete".itemtest (ps_id,ps_ware,ps_onhnd, old_res,new_res,ps_lsale,when,who,type) values (new_itemstat.ps_id ,new_itemstat.ps_ware ,new_itemstat. ps_onhnd ,old_itemstat.ps_res ,new_itemstat.ps_res ,new_itemstat.ps_lsale ,CURRENT ,USER ,'U' )); I also have triggers on this table for inserts and deletes, but these don't occur very often. Here is some of the data in the itemtest table, ordered by when descending. ps_id 380-8 ps_ware SH2 ps_onhnd 198.00 old_res 2.00 new_res 1.00 ps_lsale 07/21/1994 when 1994-08-23 16:07:37.4 who dennis type U ps_id 380-8 ps_ware SH2 ps_onhnd 199.00 old_res 1.00 new_res 2.00 ps_lsale 08/12/1994 when 1994-08-23 15:34:11.1 who roseanna type U ps_id 380-8 ps_ware SH2 ps_onhnd 199.00 old_res 310.00 # Here the quantity goes from 310 to 311, but in the new_res 311.00 # record above the old_res is down to 1. ps_lsale 08/12/1994 when 1994-08-23 12:51:58.7 who dennis type U This item ( 380-8 ), has not been deleted from the itemstat table in months. The reserve quantity just went from 311 to 1!!! This quantity change is reflected exactly in the itemstat table. HELP!! I am running the SE on a Sparc 10 Model 20, Solaris 2.3 Thanks Pete Please respond via email