0

我正在尝试创建一个触发器,如果Prog_Type​​ =将触发'EPISODE'。我收到错误的绑定错误 - PLS - 000049。我认为我的DECLARE状态有问题

CREATE OR REPLACE TRIGGER Seas_Pk_Trigger
BEFORE INSERT OR UPDATE OF Seas_ID ON Season_Table
FOR EACH ROW
DECLARE 
Prog_Type VARCHAR2(7);
BEGIN
IF (:OLD.Prog_Type <> 'EPISODE')
THEN SELECT Seas_ID_Seq.nextval into :new.Seas_ID from dual;
END IF;
END Seas_Pk_Trigger;
/
4

1 回答 1

0

如果要引用表中的列,则无需声明该列以使用伪记录或伪记录Prog_Type来引用它。如果在你的表中(我假设它是),那么只需省略声明::OLD:NEWProg_Type

CREATE OR REPLACE TRIGGER Seas_Pk_Trigger
BEFORE INSERT OR UPDATE OF Seas_ID ON Season_Table
FOR EACH ROW
BEGIN
IF (:OLD.Prog_Type <> 'EPISODE')
THEN SELECT Seas_ID_Seq.nextval into :new.Seas_ID from dual;
END IF;
END Seas_Pk_Trigger;
/

我不确定如何解释您的声明,即您只希望在Prog_Type = 'EPISODE'触发器具有<>to EPISODE 子句时触发它?

于 2013-02-12T17:50:01.517 回答