ORACLE触发器出错

时间:2013-03-21 08:19:44

标签: oracle triggers oracle10g toad

我有这个性感的触发器,从一个字段REFERENT获取一个值,解析它,在某个视图中找到一行并将一些数据填充到需要插入的原始行。然后我也重新写入REFERENT字段并消除额外的数据。

REFERENT字段如下所示:“ - XXX-123”,其中123是我在视图中搜索数据的键。希望它有意义。

CREATE OR REPLACE TRIGGER TRI_UPDATE
BEFORE INSERT
ON TBLASCENTOUTPUT_X
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (
new.STEVILKA_NAROCILA is NULL
      )
DECLARE
    PARSED_STNAROC   VARCHAR(255);
    PARSED_PRIMARY_VALUE VARCHAR(255);
BEGIN

    PARSED_STNAROC := SUBSTR(NEW.REFERENT, INSTR(NEW.REFERENT, '-', -1, 1) + 1);
    PARSED_PRIMARY_VALUE := SUBSTR(NEW.REFERENT, 1, INSTR(NEW.REFERENT, '-', -1, 1) - 1);

    select distinct v.STNAROCILA, v.DATNAROCILA, v.SIFKUPCA, v.STPONUDBE, PARSED_PRIMARY_VALUE 
        into  :NEW.STEVILKA_NAROCILA, :NEW.DATUM_NAROCILA, :NEW.SIFRA_KUPCA, :NEW.STEVILKA_PONUDBE, :NEW.REFERENT
        from ARH_NAROC v
        where v.STNAROCILA = PARSED_STNAROC;

END;

我在编译时遇到以下错误:

On line:  6
TRIGGER EASY.TRI_UPDATE
PLS-00201: identifier 'NEW.REFERENT' must be declared

请帮助。

1 个答案:

答案 0 :(得分:3)

NEW.REFERENT

之前错过冒号字符