2014-09-18 3 views
0

트리거가 거의 없습니다. 이 방아쇠에 문제가 있습니다. 커서 'cur'의 정의에 의해 선택된 것 중 하나 인 새로운 도시 (projects.plocations)를 프로젝트 테이블에 삽입하고 싶습니다. 실행하면이 오류가 발생합니다.PL/SQL 트리거 커서 오류

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; 
+0

중복 가능성 (HTTP 인 : //stackoverflow.com/questions/19066540/encountered-the-symbol) – Ben

답변

0

변경

if (:new.plocation := city) then 
    c=1; 
end if; 

if (:new.plocation = city) then 
    c := 1; 
end if; 

:= 할당 연산자이고, =

하기 비교 연산자를 [발생한 심볼 "="]의

+0

좋아. 끝난. 그러나 같은 오류와 같은 줄을 다시 보여줍니다. – Franktrt

+2

이 답변에 제공된 정보를 @Franktrt 아래 줄에 사용하면 문제를 해결할 수 있습니까? – Ben

+0

완료. 고맙습니다. 아래 줄에 c : = 1입니다. 오류 메시지가 표시됩니다. – Franktrt