0
CREATE OR REPLACE TRIGGER btinsert
BEFORE INSERT ON sample
  BEGIN
    IF (TO_CHAR(SYSDATE,'HH24:MI')
          NOT BETWEEN ('08:00' AND '22:00') THEN 
    RAISE_APPLICATION_ERROR(-20500, 'you may insert'
       ||' into EMPLOYEES table only during '
       ||' normal business hours.'); 
   END IF;
END;

但我收到一个错误:

第 8 行出现错误:PLS-00103:遇到符号“END”
6. RAISE_APPLICATION_ERROR(-20500, 'you may insert'
7. ||' 仅在 '
8.||' 正常工作时间进入 EMPLOYEES 表。');
9. 结束如果;
10.结束;

4

1 回答 1

1

你也有一些缺失的括号和多余的括号。

CREATE OR REPLACE TRIGGER btinsert
BEFORE INSERT ON sample
  BEGIN
    IF (TO_CHAR(SYSDATE,'HH24:MI') NOT BETWEEN '08:00' AND '22:00') THEN 
    RAISE_APPLICATION_ERROR(-20500, 'you may insert'
       ||' into EMPLOYEES table only during '
       ||' normal business hours.'); 
   END IF;
END;
/
于 2013-01-02T16:02:03.800 回答