简体   繁体   English

Oracle Db 11g触发器语法

[英]Oracle Db 11g trigger syntax

I try create trigger in Oracle DB 11g but no success. 我尝试在Oracle DB 11g中创建触发器,但没有成功。

CREATE OR REPLACE TRIGGER mytable_JOBUPD 
AFTER UPDATE OF jedan, trip ON mytable 
FOR EACH ROW 
BEGIN 
ADD_mytable_JOB ( :old.jedan, :old.trip, 'update', sysdate);
END mytable_JOBUPD;​

this error is dispatched: 调度此错误:

Compilation failed,line 1 (18:23:50)

PLS-00103: Encountered the symbol "," when expecting one of the following: in out ... long double ref char time timestamp interval date binary national character nchar Compilation failed,line 3 (18:23:50) PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: not null of nan infinite dangling a empty Compilation failed,line 5 (18:23:50) PLS-00103: Encountered the symbol "END" when expecting one of the following: , ; PLS-00103:预期以下其中一项时遇到符号“,”:in out ... long double ref char time timestamp interval date date binary national character nchar编译失败,第3行(18:23:50)PLS-00103:遇到以下情况之一时遇到符号“ BEGIN”:不为nan无限悬空的空悬挂编译失败,第5行(18:23:50)PLS-00103:遇到以下其中一项时遇到符号“ END”: ,; return returning 返回返回

So everrything is problem but what? 因此,一切都是问题,但是什么呢? My columns type in database are ok but I still got this error? 我在数据库中输入的列可以,但是仍然出现此错误?

Replace "FOR EACH ROW" with this: 将“ FOR EACH ROW”替换为:

REFERENCING OLD AS old NEW AS new FOR EACH ROW

I have a few similar triggers in place in 11g that follow this same syntax. 我在11g中有一些类似的触发器,它们遵循相同的语法。

Edit: you may also need a declare after that, before the begin. 编辑:在开始之前,您可能还需要声明。 If not declaring any variables, I do this: 如果不声明任何变量,我可以这样做:

DECLARE
    -- no variables
BEGIN
  --Code

Edit 2: 编辑2:

Your syntax in the example post is otherwise correct. 否则示例示例中的语法是正确的。 Those errors do seem to indicate a missing (or extra) quote, comma, or semicolon. 这些错误似乎确实表明缺少(或多余)引号,逗号或分号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM