Error on ORACLE trigger

℡╲_俬逩灬. 提交于 2019-12-04 06:32:19

问题


I have this sexy trigger, that takes a value from a field REFERENT, parses it, finds a row in some view and fills some data to original row that needs to be inserted. I also then re-write the REFERENT field and eliminate the extra data.

The REFERENT field looks like this: "-XXX-123", where 123 is the key that i search data in the view. Hope it makes sense.

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;

I am getting the following error on compile:

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

Help please.


回答1:


A colon character is missed before NEW.REFERENT



来源:https://stackoverflow.com/questions/15542436/error-on-oracle-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!