el codigo es bastante senecillo, y tener cuidado con el error de intentar insertar dentro del trigger dentro en la misma tabla porque sino queda con una recursividad infinita, el codigo es el siguiente:
create or replace
TRIGGER SMS_MT_ISR_TGR
BEFORE INSERT ON SMS_MT
FOR EACH ROW
DECLARE
PROVIDER_ID NUMBER(38,0);
MT_GATEWAY_ID NUMBER(38,0);
MT_CONNECTION_ID NUMBER(38,0);
BEGIN
SELECT CMTR.CONNECTION_ID, MTGW.MT_GATEWAY_ID, CON.PROVIDER_ID INTO MT_CONNECTION_ID, MT_GATEWAY_ID, PROVIDER_ID --INTO :NEW.MT_CONNECTION_ID, :NEW.MT_GATEWAY_ID, :NEW.PROVIDER_ID
FROM SENDING_MT SMT, "ACCOUNT" AC, MT_GATEWAY MTGW, CONNECTION_X_MT_ROUTING CMTR, MT_ROUTING MTR, CONNECTION CON
WHERE AC.ACCOUNT_ID=SMT.ACCOUNT_ID
AND MTGW.MT_GATEWAY_ID=AC.MT_GATEWAY_ID
AND MTR.MT_GATEWAY_ID=MTGW.MT_GATEWAY_ID
AND CMTR.MT_ROUTING_ID=MTR.MT_ROUTING_ID
AND CON.CONNECTION_ID=CMTR.CONNECTION_ID
AND MTR.OPERATOR_ID=:NEW.OPERATOR_ID
AND SMT.SENDING_MT_ID=:NEW.SENDING_MT_ID;
:NEW.PROVIDER_ID:=PROVIDER_ID;
:NEW.MT_GATEWAY_ID:=MT_GATEWAY_ID;
:NEW.MT_CONNECTION_ID:=MT_CONNECTION_ID;
END;
No hay comentarios:
Publicar un comentario
Agradezco el interes en el tema, estaré atento para poder leer su comentario.