触发编译错误

时间:2016-10-21 11:55:02

标签: plsql

以下是我遇到编译错误的触发器:

create or replace 
TRIGGER DSP_MAIN.TRG_DSP_TXN_INS_UPD
AFTER INSERT OR UPDATE
ON DSP_MAIN.DSP_TRANSACTION_DTLS REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
  IF INSERTING THEN
    INSERT INTO  DSP_HIST.DSP_TRANSACTION_DTLS_HISTORY(
    VALUES (
    :NEW.TXN_ID,
    :NEW.SESSION_ID,
    :NEW.TXN_STATUS_ID,     
    :NEW.STATE_ID,
    :NEW.OPERATION_ID,
    :NEW.UBIGEO,  
    :NEW.DISTRICT,
    :NEW.DOC_TYPE,
    :NEW.DOC_VALUE,
    :NEW.TARIFF_PLAN,
    :NEW.DATA_PROTECT,
    :NEW.CONTRACT_ACCEPT,
    :NEW.BIO_RESULT,
    :NEW.LAST_STATUS_MOD_TIME,
    :NEW.LAST_STATE_MOD_TIME,
    :NEW.REQUEST_START_TIME,
    :NEW.REQUEST_END_TIME,
    :NEW.INCIDENT_ID,
    :NEW.NON_BIO_RESULT    
    ); 
    ELSIF UPDATING THEN
        UPDATE DSP_HIST_TEST.DSP_TRANSACTION_DTLS_HISTORY SET
        SESSION_ID = :NEW.SESSION_ID,     
        TXN_STATUS_ID = :NEW.TXN_STATUS_ID,
        STATE_ID = :NEW.STATE_ID,
        OPERATION_ID = :NEW.OPERATION_ID,
        UBIGEO = :NEW.UBIGEO,    
        DISTRICT = :NEW.DISTRICT,
        DOC_TYPE = :NEW.DOC_TYPE,
        DOC_VALUE = :NEW.DOC_VALUE,
        TARIFF_PLAN = :NEW.TARIFF_PLAN,
        DATA_PROTECT = :NEW.DATA_PROTECT
        CONTRACT_ACCEPT = :NEW.CONTRACT_ACCEPT
        BIO_RESULT = :NEW.BIO_RESULT
        LAST_STATUS_MOD_TIME = :NEW.LAST_STATUS_MOD_TIME
        LAST_STATE_MOD_TIME = :NEW.LAST_STATE_MOD_TIME
        REQUEST_START_TIME = :NEW.REQUEST_START_TIME
        REQUEST_END_TIME = :NEW.REQUEST_END_TIME
        INCIDENT_ID = :NEW.INCIDENT_ID
        NON_BIO_RESULT = :NEW.NON_BIO_RESULT

    WHERE TXN_ID = :OLD.TXN_ID;
    END IF;
     DBMS_OUTPUT.PUT_LINE('DBMS_OUTPUT.PUT_LINE('Record successfull UPDATED IN DSP TRANSACTION HISTORY TABLE');
  END;
cmbAll

是我在语法上做错了吗?

2 个答案:

答案 0 :(得分:1)

有一个不属于此的paranthesis。之后...... DTLS_HISTORY

INSERT INTO  DSP_HIST.DSP_TRANSACTION_DTLS_HISTORY
values(.....);

此外,更新声明中还有很多缺少的逗号

UPDATE DSP_HIST_TEST.DSP_TRANSACTION_DTLS_HISTORY SET
        SESSION_ID = :NEW.SESSION_ID,     
        TXN_STATUS_ID = :NEW.TXN_STATUS_ID,
        STATE_ID = :NEW.STATE_ID,
        OPERATION_ID = :NEW.OPERATION_ID,
        UBIGEO = :NEW.UBIGEO,    
        DISTRICT = :NEW.DISTRICT,
        DOC_TYPE = :NEW.DOC_TYPE,
        DOC_VALUE = :NEW.DOC_VALUE,
        TARIFF_PLAN = :NEW.TARIFF_PLAN,
        DATA_PROTECT = :NEW.DATA_PROTECT,
        CONTRACT_ACCEPT = :NEW.CONTRACT_ACCEPT,
        BIO_RESULT = :NEW.BIO_RESULT,
        LAST_STATUS_MOD_TIME = :NEW.LAST_STATUS_MOD_TIME,
        LAST_STATE_MOD_TIME = :NEW.LAST_STATE_MOD_TIME,
        REQUEST_START_TIME = :NEW.REQUEST_START_TIME,
        REQUEST_END_TIME = :NEW.REQUEST_END_TIME,
        INCIDENT_ID = :NEW.INCIDENT_ID,
        NON_BIO_RESULT = :NEW.NON_BIO_RESULT

    WHERE TXN_ID = :OLD.TXN_ID;

答案 1 :(得分:0)

我猜DBMS_OUTPUT语句导致问题。你可以改成它。

DBMS_OUTPUT.PUT_LINE('Record successfull UPDATED IN DSP TRANSACTION HISTORY TABLE');