PLS-00103 is the PL/SQL compiler's syntax error. The parser reached a word or symbol that cannot come at that point, and lists what it expected instead. The reported position is where the parser noticed the problem, which is often just after the real mistake: a missing semicolon on the line before is the most common cause. Read the symbol it found and the expected list, then look at the code just before that position.
Reproduce the Error
Example:
declare
v_total number := 0
begin
v_total := v_total + 1;
end;
/
begin
if 1 = 1 then
null;
elseif 2 = 2 then
null;
end if;
end;
/Output:
begin
*
ERROR at line 3:
ORA-06550: line 3, column 1:
PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset <=> <->
<#>
The symbol ";" was substituted for "BEGIN" to continue.
elseif 2 = 2 then
*
ERROR at line 4:
ORA-06550: line 4, column 10:
PLS-00103: Encountered the symbol "2" when expecting one of the following:
:= . ( @ % ;
ORA-06550: line 7, column 4:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
if- In the first block, the declaration on line 2 has no semicolon, so the parser meets BEGIN on line 3 while still expecting the end of the declaration; ";" is in its list.
- In the second block, ELSEIF is not a keyword. The parser reads it as a name and expects an assignment or a call, so the symbol 2 surprises it, and END IF; later fails too.
Fix: Correct the Code Before the Position
Example:
set serveroutput on
declare
v_total number := 0; -- semicolon added
begin
v_total := v_total + 1;
if v_total = 1 then
dbms_output.put_line('one');
elsif v_total = 2 then -- ELSIF, not ELSEIF
dbms_output.put_line('two');
end if;
end;
/Output:
one PL/SQL procedure successfully completed.
Common Causes
- A missing semicolon after a declaration or statement.
- ELSEIF or ELSE IF instead of ELSIF.
- = instead of := for assignment, or := in a condition.
- A reserved word, such as BEGIN, END, or SELECT, used as a variable name.
- A missing END IF, END LOOP, or END; for a block.
- In SQL*Plus or SQLcl, a block not ended by a line with only a slash, so the next statement is read as part of it.
Related Guides
Conclusion
PLS-00103 means the parser met a symbol it did not expect. Look at the reported line and the one before it, check semicolons, ELSIF, assignments, and END keywords, and let the expected list guide you.
