错误(8,1):PLS-00103:遇到符号“INSERT”

时间:2015-12-23 16:39:08

标签: sql oracle-sqldeveloper

我想创建触发器后收到此消息。我谷歌这个错误,但我没有找到任何东西。有什么想法吗?

我的触发器看起来像这样:

CREATE or REPLACE TRIGGER add_disease AFTER INSERT ON Disease
FOR EACH ROW
BEGIN
UPDATE Doc
SET DocFile = 'Don't kno'
WHERE IDFile = :new.IDFile;
END;

1 个答案:

答案 0 :(得分:0)

要在SQL中转义单引号,只需添加第二个单引号:

CREATE or REPLACE TRIGGER add_disease AFTER INSERT ON Disease
FOR EACH ROW
BEGIN
UPDATE Doc
SET DocFile = 'Don''t kno' //This was your problem.
WHERE IDFile = ':new.IDFile;' //Also, I'm guessing this needs to be in single quotes, as well - not sure if the semicolon is part of the value to which you're comparing, but, if not, just remove it.
END;