仅供 参考 create or replace trigger "QFII".fv_voucherdata_detail_update after update on fv_voucherdata_detail for each row declare -- local variables here v_fund_code par_fund.fund_code%type;begin begin select fund_code,periodid,strdate into v_fund_code,v_periodid,v_genstrdate from fv_voucherdata where lgvoucherid = :old.LGVOUCHERID; exception when others then return; END; update fv_acctbalance set BMONEYCREDIT=BMONEYCREDIT -:old.BMONEYCREDIT, BMONEYDEBIT=BMONEYDEBIT -:old.BMONEYDEBIT, YMONEYDEBIT=YMONEYDEBIT -:old.YMONEYDEBIT, YMONEYCREDIT=YMONEYCREDIT -:old.YMONEYCREDIT, DBLDEBITQUANTITY=DBLDEBITQUANTITY -:old.QUANTITYDEBIT, DBLCREDITQUANTITY=DBLCREDITQUANTITY -:old.QUANTITYCREDIT where fund_code=v_fund_code and periodid=v_periodid and GENSTRDATE=v_genstrdate and accountid=:old.ACCOUNTID and ORIGINALMARK='0' and STOCK_CODE=:old.STOCK_CODE and seat_code=:old.seat_code;end;
create or replace trigger "QFII".fv_voucherdata_detail_insert after insert on fv_voucherdata_detail for each row declare -- local variables here v_fund_code par_fund.fund_code%type; begin begin select fund_code,periodid,strdate into v_fund_code,v_periodid,v_genstrdate from fv_voucherdata where lgvoucherid = :new.LGVOUCHERID; exception when others then return; END; update fv_acctbalance set BMONEYCREDIT=BMONEYCREDIT + :new.BMONEYCREDIT, BMONEYDEBIT=BMONEYDEBIT+:new.BMONEYDEBIT, YMONEYDEBIT=YMONEYDEBIT+:new.YMONEYDEBIT, YMONEYCREDIT=YMONEYCREDIT+:new.YMONEYCREDIT, DBLDEBITQUANTITY=DBLDEBITQUANTITY+:new.QUANTITYDEBIT, DBLCREDITQUANTITY=DBLCREDITQUANTITY+:new.QUANTITYCREDIT where fund_code=v_fund_code and periodid=v_periodid and GENSTRDATE=v_genstrdate and COIN_CODE=:new.COIN_CODE and accountid=:new.ACCOUNTID and ORIGINALMARK='0' and STOCK_CODE=:new.STOCK_CODE and seat_code=:new.seat_code; end;
create or replace trigger "QFII".fv_voucherdata_detail_update
after update on fv_voucherdata_detail
for each row
declare
-- local variables here
v_fund_code par_fund.fund_code%type;begin begin
select fund_code,periodid,strdate
into v_fund_code,v_periodid,v_genstrdate
from fv_voucherdata
where lgvoucherid = :old.LGVOUCHERID;
exception when others then
return;
END;
update fv_acctbalance
set BMONEYCREDIT=BMONEYCREDIT -:old.BMONEYCREDIT,
BMONEYDEBIT=BMONEYDEBIT -:old.BMONEYDEBIT,
YMONEYDEBIT=YMONEYDEBIT -:old.YMONEYDEBIT,
YMONEYCREDIT=YMONEYCREDIT -:old.YMONEYCREDIT,
DBLDEBITQUANTITY=DBLDEBITQUANTITY -:old.QUANTITYDEBIT,
DBLCREDITQUANTITY=DBLCREDITQUANTITY -:old.QUANTITYCREDIT
where fund_code=v_fund_code
and periodid=v_periodid
and GENSTRDATE=v_genstrdate
and accountid=:old.ACCOUNTID
and ORIGINALMARK='0'
and STOCK_CODE=:old.STOCK_CODE
and seat_code=:old.seat_code;end;
after insert on fv_voucherdata_detail
for each row
declare
-- local variables here
v_fund_code par_fund.fund_code%type;
begin begin
select fund_code,periodid,strdate
into v_fund_code,v_periodid,v_genstrdate
from fv_voucherdata
where lgvoucherid = :new.LGVOUCHERID;
exception when others then
return;
END; update fv_acctbalance
set BMONEYCREDIT=BMONEYCREDIT + :new.BMONEYCREDIT,
BMONEYDEBIT=BMONEYDEBIT+:new.BMONEYDEBIT,
YMONEYDEBIT=YMONEYDEBIT+:new.YMONEYDEBIT,
YMONEYCREDIT=YMONEYCREDIT+:new.YMONEYCREDIT,
DBLDEBITQUANTITY=DBLDEBITQUANTITY+:new.QUANTITYDEBIT,
DBLCREDITQUANTITY=DBLCREDITQUANTITY+:new.QUANTITYCREDIT
where fund_code=v_fund_code
and periodid=v_periodid
and GENSTRDATE=v_genstrdate
and COIN_CODE=:new.COIN_CODE
and accountid=:new.ACCOUNTID
and ORIGINALMARK='0'
and STOCK_CODE=:new.STOCK_CODE
and seat_code=:new.seat_code;
end;