我试着做到以下几点:PL/SQL触发器来概括行和更新其他行
写触发这样一个部门的预算在部门支付给员工的工资总和(记员工只在部门工作的时间百分比)。所述DEPT表包括部门ID(DID),预算,经理ID,所述员工(EMP)表包括EMPID(EID),工资,奖金,AGE,以及WORKS表包括EID,DID working_time。
我写的代码是:
CREATE TRIGGER BUDGET_CHK
BEFORE
INSERT OR UPDATE OF BUDGET OR DELETE ON DEPT
FOR EACH ROW
BEGIN
UPDATE DEPT
SET BUDGET =
(SELECT SUM(E.SALARY)
FROM EMP E, WORKS W, DEPT D
WHERE E.eid=W.eid AND D.did=W.did
GROUP BY W.did)
END;
我是新来的Oracle。有人能纠正我吗?谢谢!
错误(从下面的评论):
pl/sql: sql statement ignored
ORA-00933 sql command not properly ended
Error(16): PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following: (begin case declare end exception exit for goto if
loop mod null pragma raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> << continue close
current delete fetch lock insert open rollback savepoint set sql execute
commit forall merge pipe purge
现有的问题是什么? –
编译器回应了我的错误 – jasonwzm
发布错误 –