【发布时间】:2014-09-18 08:45:30
【问题描述】:
我几乎是触发器的新手。我有这个触发器的问题。我想在项目表中插入一个新城市(projects.plocations),它是光标“cur”的定义选择的城市之一。 当我执行时,我得到了这个错误:
12/21 PLS-00103:Trovato il simbolo "=" anzichÚ uno dei seguenti。
翻译:12/21 PLS-00103:在预期以下之一时遇到符号“=”:
但是,如果我在没有行的情况下执行,它不会给我任何错误:
**if (:new.plocation := city) then
c=1;
end if;**
你能告诉我为什么吗?
create or replace trigger tr_projects
before insert on projects
for each row
declare
exc exception;
cursor cur is (
(select dlocation from dept_locations) minus (select plocation from projects));
city varchar(30);
c number(1):=0;
begin
open cur;
loop
fetch cur into city;
exit when cur%notfound;
if (:new.plocation := city) then
c=1;
end if;
end loop;
close cur;
if c=0 then
raise exc;
end if;
exception
when exc then
raise_application_error(-20001,'Unknown city');
end;
【问题讨论】:
-
Encountered the symbol "=" 的可能重复项