忽略错误语句,此处不允许列

时间:2015-05-20 08:05:39

标签: oracle plsql triggers

CREATE OR REPLACE
TRIGGER T_CIM_INV_CAT1_HIS
    BEFORE INSERT OR UPDATE OR DELETE ON CIM_INV_CAT1
    REFERENCING NEW AS n OLD AS o
    FOR EACH ROW
DECLARE
    vCIC1_ID NUMBER ;
    vCIC1_SERIALNO_OLD VARCHAR2(20) := :o.CIC1_SERIALNO;
    vCIC1_SERIALNO_NEW VARCHAR2(20) := :n.CIC1_SERIALNO;
    vCIC1_ASSETNO_OLD NUMBER := :o.CIC1_ASSETNO;
    vCIC1_ASSETNO_NEW NUMBER := :n.CIC1_ASSETNO;
    vCIS_ID_OLD NUMBER := :o.CIS_ID;
    vCIS_ID_NEW NUMBER := :n.CIS_ID;
    vCIFCP_ID_OLD NUMBER := :o.CIFCP_ID;
    vCIFCP_ID_NEW NUMBER := :n.CIFCP_ID;
    vCIC1H_UPDATE_BY VARCHAR2(20) := :n.CIC1_UPDATE_BY;
    vCIC1H_UPDATE_DATE DATE := :n.CIC1_UPDATE_DATE;
BEGIN
    IF INSERTING THEN
        vCIC1_ID := :n.CIC1_ID;     
    ELSE
        vCIC1_ID := :o.CIC1_ID;     
    END IF;

INSERT INTO CIM_INV_CAT1_HIS
(   CIC1H_ID, <----STATEMENT IGNORED
    CIC1_ID,
    CIC1_SERIALNO_OLD,
    CIC1_SERIALNO_NEW,
CIC1_ASSETNO_OLD,
    CIC1_ASSETNO_NEW,
CIS_ID_OLD,
CIS_ID_NEW,
CIFCP_ID_OLD,
CIFCP_ID_NEW,
    CIC1H_UPDATE_BY,
    CIC1H_UPDATE_DATE       )
VALUES
(   CENTORY_CIC1H_ID_SEQ.NEXTVAL,
     vCIC1_ID,
    vCIC1_SERIALNO_OLD,
    vCIC1_SERIALN0_NEW,
vCIC1_ASSETNO_OLD, <---COLUMN NOT ALLOWED
    vCIC1_ASSETNO_NEW,
vCIS_ID_OLD,
    vCIS_ID_NEW,
vCIFCP_ID_OLD,
    vCIFCP_ID_NEW,
    vCIC1H_UPDATE_BY,
    vCIC1H_UPDATE_DATE  );
END;

我收到了上面提到的错误。我已经为CIC1H_ID创建了序列。当我尝试编译查询时,编译器日志显示错误。

1 个答案:

答案 0 :(得分:1)

你刚刚发布了一个拼写错误,就是你发布的第42行(你标记的行之前的那个;想想你在PL / SQL部分中的计数对于你所做的注释都是一个)。这样:

IFERROR(...,"")

应该是:

vCIC1_SERIALN0_NEW,

没有名为vCIC1_SERIALNO_NEW, 的局部变量(零),因此默认情况下它被解释为(列)标识符,因此错误消息。