PLS-00103: Encountered the symbol when expecting one of the following 해결하기

PLS-00103 오류가 다음과 같이 발생할 때에 해결하는 방법에 대해 안내해 드리겠습니다.

PLS-00103: Encountered the symbol when expecting one of the following

PLS-00103: Encountered the symbol "PROCEDURE_NAME" when expecting one of the following
ORA-06550: line 0, column 0:
PLS-00103: Encountered the symbol "PROCEDURE_NAME" when expecting one of the following:

   := . ( @ % ;
The symbol ":=" was substituted for "PROCEDURE_NAME" to continue.

익명 블록 등을 사용하여 프로시저를 호출할 때에는 다음과 같이 하면 PLS-00103: Encountered the symbol "PROCEDURE_NAME" when expecting one of the following 오류가 발생합니다.

--PLS-00103: Encountered the symbol "PROCEDURE_NAME" when expecting one of the following:
--   := . ( @ % ;
--The symbol ":=" was substituted for "PROCEDURE_NAME" to continue.
BEGIN
   EXEC PROCEDURE_NAME;
END;

다음과 같이 변경해 주세요.

BEGIN
   PROCEDURE_NAME;
END;

또는 직접 호출 시 다음과 같이 진행합니다.

EXEC PROCEDURE_NAME;

PLS-00103: Encountered the symbol 'END' when expecting one of the following

PLS-00103 오류는 END 심볼을 예상치 않게 만나는 경우에 발생합니다. 이를 해결하려면 END; 심볼 이전으로 거슬러 올라가서 PL/SQL 문법을 확인해 주십시오.

글자 하나가 오타인 경우가 있을 가능성도 있으므로 코드 포맷을 통해 어느 라인이 문제인지 1차로 점검해 보는 것도 오류 해결 시간을 단축하는 데 도움이 많이 될 것입니다.

다음과 같은 심볼이 선행해야 합니다.

( begin case declare 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

다음은 PLS-00103 오류가 발생하는 예시 자료입니다. 본문에 아무것도 넣지 않아서 오류가 발생합니다.

PLS-00103: Encountered the symbol 'END' when expecting one of the following 해결하기

BEGIN
--   NULL;
END;
Error at line 1
ORA-06550: line 3, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:

   ( begin case declare 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

Script Terminated on line 1.

PLS-00103: Encountered the symbol '(' when expecting one of the following

오라클 데이터베이스에서 CREATE PROCEDURE 구문을 시도하는 경우, PLS-00103: Encountered the symbol "(" 오류가 발생하였을 때 처리 방법을 안내해 드리려고 합니다.

CREATE OR REPLACE PROCEDURE USER_NAME.PROCEDURE_NAME (
     P_IN IN VARCHAR2
 )
 IS
 BEGIN
    DBMS_OUTPUT.PUT_LINE ('my name is BEOMSANG');
 END;
 /

Procedure created.

Create Procedure PLS-00103: Encountered the symbol '('

해당 오류가 발생하는 예제 자료는 다음과 같습니다.

CREATE OR REPLACE PROCEDURE USER_NAME.PROCEDURE_NAME (
    P_IN IN VARCHAR2 (1)
)
IS
BEGIN
   DBMS_OUTPUT.PUT_LINE ('my name is BEOMSANG');
END;
/

---------------------------------------------------
Warning: Procedure created with compilation errors.

PLS-00103: Encountered the symbol "("

PLS-00103: Encountered the symbol "(" 오류를 간단히 해석하면 예기치 않은 심볼 "("을 발견하였다는 것입니다.

이러한 오류를 해결하려면, 예외에서 말하는 심볼이 처음 발생한 지점을 살펴보는 것이 도움이 많이 될 것입니다. 실제로 해당 예제는 불필요한 변수 길이를 할당하여 오류가 발생한 것이어서, 해당 부분을 제거하여 처리할 수 있습니다. [P_IN IN VARCHAR2 (1)] 이 부분을 [P_IN IN VARCHAR2]과 같이 변경하여 해결할 수 있습니다.

PLS-00103: Encountered the symbol "WHEN" when expecting one of the following

예외 처리를 추가하려다가 익셉션을 누락한 경우를 생각해볼 수 있습니다.

ORA-06550: line 4, column 4:
PLS-00103: Encountered the symbol "WHEN" 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
The symbol "exception" was substituted for "WHEN" to continue.

--PLS-00103: Encountered the symbol "WHEN" when expecting one of the following
BEGIN
   NULL;
--EXCEPTION
   WHEN OTHERS
   THEN
      NULL;
END;
/

댓글