我试图检查触发器是否在表中TUTPRAC
包含和的插入记录CLASSTIME < '9AM' OR > '6PM'
。如果是这样,则将某些字段更改为来更新该记录NULL
。
CREATE TRIGGER CheckBeforeAfterHours
BEFORE INSERT OR UPDATE OF CLASS_TIME ON TUTPRAC
FOR EACH ROW
BEGIN
IF (:NEW.CLASS_TIME < '09:00' OR > '18:00') THEN
:NEW.STAFFNO := NULL;
:NEW.CLASS_DAY := NULL;
:NEW.CLASS_TYPE := NULL;
:NEW.ROOMNUM := NULL;
END IF;
END CheckBeforeAfterHours;
TUTPRAC
表格栏:
CLASSID (PK), UNITCODE, STAFFNO, CLASSDAY, CLASSTIME, CLASSTYPE, ROOMNUM
该字段CLASSTIME
设置为varchar(5)
。
我用Oracle SQLDeveloper
。
问题
我的问题是,当我尝试运行触发器时,我一直收到此错误:
Error(2,36):
PLS-00103: Encountered the symbol ">" when expecting one of the following:
( - + case mod new not null <an identifier> <a double-quoted delimited-identifier>
<a bind variable> continue avg count current exists max min prior sql stddev
sum variance execute forall merge time timestamp interval
date <a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternatively
正确的语法是:
IF (:NEW.CLASS_TIME < '09:00' OR :NEW.CLASS_TIME > '18:00') THEN
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句