【发布时间】:2015-10-24 15:37:23
【问题描述】:
如果插入的记录在表 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
【问题讨论】:
标签: oracle syntax plsql date-comparison database-trigger