The PLS-00103: Encountered the symbol “END” when expecting one of the following: error occurs when the keyword “END” is encountered when the PL/SQL code is expected to have a valid literal value. When oracle scans the PL/SQL code while compiling, it detects the “END” symbol instead of the literal one. In most cases, the error occurs just before the “END” statement line. If you fix the error where the line number is displayed, the error PLS-00103: Encountered the symbol “END” when expecting one of the following: will be resolved.
The PLS-00103: Encountered the symbol “END” when expecting one of the following: error appears right before the “END” keyword. Oracle was expecting a literal in the code, but instead found the symbol “END.” The problem isn’t caused by the keyword “END”. The error is caused by a programming error just before the keyword “END”. This error can be found in procedures, triggers, functions, packages, and PL/SQL blocks
Exception
The exception would show the exact error as well as the line number where it happened. The keyword “END” appears in the error message. The error occurs right before the word “END”. In the exception stack trace, the expected keywords or literals will be mentioned.
Error report -
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
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Cause
Oracle was anticipating any of the literals in the code, but only saw the symbol “END”. The error is very often not in the keyword “END.” The error will appear right before the END keyword on the line. In the error stack trace, the expected literal will be identified. To fix this error, the expected literal should be added or corrected in the code.
Solution 1
The keywords “BEGIN” and “END” are used to start and end a block in Oracle. If there isn’t a statement in the BEGIN and END blocks, the code would throw an error. Between begin and end, at least one statement should be available. Delete the begin and end statements or add at least one statement in between if no statement is available.
declare
begin
end;
Exception
Error report -
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
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Solution
declare
begin
dbms_output.put_line('yawin');
end;
Output
yawin
PL/SQL procedure successfully completed.
Solution 2
In most of cases, the error occurs in the line just before the END statement. Double check the list just before the END statement. If any error exist, correct it. The error stack trace will display some possible changes in the error line. Before the “END” keyword, Oracle expects one of the specified keywords or literals to be added.
declare
begin
dbms_output.put_line('yawin')
end;
Exception
Error report -
ORA-06550: line 4, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
:= . ( % ;
The symbol ";" was substituted for "END" to continue.
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Solution
declare
begin
dbms_output.put_line('yawin');
end;
Output
yawin
PL/SQL procedure successfully completed.
Solution 3
Oracle will throw an error if the keyword “END” is used in an unlikely location. Oracle encountered the symbol “END” as it was expecting some other keyword or literals in this instance. The “END” keyword should be added to close the block of statements begun with keyword “START”. The BEGIN and END keywords should be the same and in the same order.
declare
empid numeric(1);
begin
dbms_output.put_line('yawin');
begin
IF empid > 0 THEN
declare
empid1 numeric(1);
dbms_output.put_line('yawin');
end;
end if;
end;
Exception
Error report -
ORA-06550: line 10, column 17:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "." to continue.
ORA-06550: line 11, column 6:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
06550. 00000 - "line %s, column %s:\n%s"
Solution
declare
empid numeric(1);
begin
dbms_output.put_line('yawin');
IF empid > 0 THEN
declare
empid1 numeric(1);
begin
dbms_output.put_line('yawin');
end;
end if;
end;
Output
yawin
PL/SQL procedure successfully completed.
Solution 4
The error “PLS-00103: Encountered the symbol “END” when expecting one of the following:” would be thrown in the code if the BEGIN and END statements are missing. Before beginning a block of sentences, Oracle expects the BEGIN keyword. The END keyword is supposed to appear at the end of the statement block. The error would be thrown if the BEGIN and END statements are not present in the blocks.
declare
empid numeric(1);
begin
dbms_output.put_line('yawin');
begin
IF empid > 0 THEN
declare
empid1 numeric(1);
dbms_output.put_line('yawin');
end if;
end;
Exception
Error report -
ORA-06550: line 9, column 17:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "." to continue.
ORA-06550: line 10, column 2:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
06550. 00000 - "line %s, column %s:\n%s"
Solution
declare
empid numeric(1);
begin
dbms_output.put_line('yawin');
begin
IF empid > 0 THEN
declare
empid1 numeric(1);
begin
dbms_output.put_line('yawin');
end
end if;
end;
Output
yawin
PL/SQL procedure successfully completed.