如果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;
/
答案 0 :(得分:0)
如果要引用表中的列,则无需声明列Prog_Type
以使用:OLD
或:NEW
伪记录引用它。如果Prog_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'
触发{EPESODE <>
时触发它?