-------存储过程
--/
create or replace trigger pgtxnInsert
before insert
on pg_txn for each row
begin
:NEW.txnday := SYSDATE+1;
if(:new.txntype='01') then
insert into User_Info2(pkid,orderid,stxnamt,txnday)
values(:new.pkid,:new.ORDERID,:new.STXNAMT,:new.txnday);
end if;
end;
/
--/
create or replace trigger pgtxn2Insert
after insert
on USER_INFO2 for each row
begin
pad_amt(:new.pkid,:new.ORDERID,:new.STXNAMT,:new.txnday);--执行带参数的存储过程
end;
/
---中间表
create table User_Info2 (
pkid VARCHAR2(500),
orderid VARCHAR2(200),
stxnamt NUMBER(20,2),
txnday Date DEFAULT sysdate not null ,
constraint PK_User2_Info primary key (pkid)
);
---------------如上是我的过程,我们是第三方支付的系统,其中pg_txn是我的业务交易表,User_Info2 是我建的一张中间表,我想以此对交易进行排重,因为交易是在网关进行的,我不想因为排重影响网关的交易效率,所以建立中间表,然后异步触发