Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-12-01 · container image gvenzl/oracle-free:23-slim
ORA-06550 only says where: line 5, column 38. The actual reason is the next line, usually a PLS- code or PL/SQL: ORA- code. Search for that code, not for ORA-06550.
Line numbers count from the first line of the block (DECLARE or BEGIN), not from the top of your script. A second ORA-06550 ... Statement ignored just follows the first one and can be ignored.
01PLS-00201: a variable name typo
The variable is v_total, but line 5 uses v_totl. The error pointed to line 5, column 38 with PLS-00201: identifier 'V_TOTL' must be declared.
Fix the name. The block printed total = 800.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, sal NUMBER);
INSERT INTO emp VALUES (1, 300);
INSERT INTO emp VALUES (2, 500);
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.SET SERVEROUTPUT ON
DECLARE
v_total NUMBER;
BEGIN
SELECT SUM(sal) INTO v_total FROM emp;
DBMS_OUTPUT.PUT_LINE('total = ' || v_totl);
END;
/ DBMS_OUTPUT.PUT_LINE('total = ' || v_totl);
*
ERROR at line 5:
ORA-06550: line 5, column 38:
PLS-00201: identifier 'V_TOTL' must be declared
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored
Help: https://docs.oracle.com/error-help/db/ora-06550/SELECT SUM(sal) AS total FROM emp; TOTAL
----------
800
1 row selected.PLS-00201 also appears for a table, package or function you cannot see. If the name is spelled right, check the owner and privileges.
SET SERVEROUTPUT ON
DECLARE
v_total NUMBER;
BEGIN
SELECT SUM(sal) INTO v_total FROM emp;
DBMS_OUTPUT.PUT_LINE('total = ' || v_total);
END;
/total = 800
PL/SQL procedure successfully completed.02PLS-00103: a missing semicolon
v_cnt NUMBER := 0 has no ;. Oracle noticed only on the next line, so the error says line 3, column 1: Encountered the symbol "BEGIN", and the long list of expected symbols includes ;.
Add the semicolon to the end of line 2. The block printed count = 2.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, sal NUMBER);
INSERT INTO emp VALUES (1, 300);
INSERT INTO emp VALUES (2, 500);
COMMIT;Table created.
1 row created.
1 row created.
Commit complete.SET SERVEROUTPUT ON
DECLARE
v_cnt NUMBER := 0
BEGIN
SELECT COUNT(*) INTO v_cnt FROM emp;
DBMS_OUTPUT.PUT_LINE('count = ' || v_cnt);
END;
/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.
Help: https://docs.oracle.com/error-help/db/ora-06550/SELECT COUNT(*) AS cnt FROM emp; CNT
----------
2
1 row selected.With PLS-00103, look at the line before the reported one first. The symbol it encountered is where Oracle noticed, not where you made the mistake.
SET SERVEROUTPUT ON
DECLARE
v_cnt NUMBER := 0;
BEGIN
SELECT COUNT(*) INTO v_cnt FROM emp;
DBMS_OUTPUT.PUT_LINE('count = ' || v_cnt);
END;
/count = 2
PL/SQL procedure successfully completed.03PLS-00428: SELECT without INTO inside a PL/SQL block
Inside BEGIN ... END, the line SELECT sal FROM emp WHERE emp_id = 101; has nowhere to put its result. Oracle stops at line 4, column 3 with PLS-00428: an INTO clause is expected in this SELECT statement.
The same SELECT run on its own in SQL*Plus works and returns 300. In PL/SQL it needs a target: after changing it to SELECT sal INTO v_sal FROM emp WHERE emp_id = 101; the block printed sal = 300.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, ename VARCHAR2(20), sal NUMBER);
INSERT INTO emp VALUES (101, 'KIM', 300);
COMMIT;Table created.
1 row created.
Commit complete.SET SERVEROUTPUT ON
DECLARE
v_sal NUMBER;
BEGIN
SELECT sal FROM emp WHERE emp_id = 101;
DBMS_OUTPUT.PUT_LINE('sal = ' || v_sal);
END;
/ SELECT sal FROM emp WHERE emp_id = 101;
*
ERROR at line 4:
ORA-06550: line 4, column 3:
PLS-00428: an INTO clause is expected in this SELECT statement
Help: https://docs.oracle.com/error-help/db/ora-06550/SELECT sal FROM emp WHERE emp_id = 101; SAL
----------
300
1 row selected.Every plain SELECT inside PL/SQL needs INTO (or a cursor loop). The line number counts from DECLARE, so line 4 here is the SELECT line.
SET SERVEROUTPUT ON
DECLARE
v_sal NUMBER;
BEGIN
SELECT sal INTO v_sal FROM emp WHERE emp_id = 101;
DBMS_OUTPUT.PUT_LINE('sal = ' || v_sal);
END;
/sal = 300
PL/SQL procedure successfully completed.04PLS-00306: wrong number of arguments to a procedure
raise_sal takes two parameters, but the call raise_sal(101) passed one. The message was wrong number or types of arguments in call to 'RAISE_SAL'.
user_arguments showed the definition: P_EMP_ID NUMBER and P_PCT NUMBER, both IN. Calling raise_sal(101, 10) worked and salary went from 300 to 330.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, sal NUMBER);
INSERT INTO emp VALUES (101, 300);
COMMIT;
CREATE OR REPLACE PROCEDURE raise_sal(p_emp_id IN NUMBER, p_pct IN NUMBER) IS
BEGIN
UPDATE emp SET sal = sal * (1 + p_pct / 100) WHERE emp_id = p_emp_id;
END;
/Table created.
1 row created.
Commit complete.
Procedure created.BEGIN
raise_sal(101);
END;
/ raise_sal(101);
*
ERROR at line 2:
ORA-06550: line 2, column 3:
PLS-00306: wrong number or types of arguments in call to 'RAISE_SAL'
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
Help: https://docs.oracle.com/error-help/db/ora-06550/COLUMN argument_name FORMAT A10
COLUMN data_type FORMAT A10
COLUMN in_out FORMAT A6
SELECT argument_name, position, data_type, in_out FROM user_arguments WHERE object_name = 'RAISE_SAL' ORDER BY position;ARGUMENT_N POSITION DATA_TYPE IN_OUT
---------- ---------- ---------- ------
P_EMP_ID 1 NUMBER IN
P_PCT 2 NUMBER IN
2 rows selected.user_arguments lists the real parameters in order: P_EMP_ID (position 1) and P_PCT (position 2), both NUMBER and IN. The call passed only the first one.
BEGIN
raise_sal(101, 10);
END;
/
SELECT emp_id, sal FROM emp;
COMMIT;PL/SQL procedure successfully completed.
EMP_ID SAL
---------- ----------
101 330
1 row selected.
Commit complete.05PLS-00905: the procedure you call is INVALID
pay_bonus used the column bonus, and then the column was renamed to bonus_amt. The procedure itself was not touched, but calling it with BEGIN pay_bonus; END; failed with PLS-00905: object LAB_A.PAY_BONUS is invalid. Oracle tried to recompile it on the call, the compile failed, so the caller got ORA-06550.
After changing the procedure to use bonus_amt, its status became VALID and the same call ran: salary went from 300 to 330.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, sal NUMBER, bonus NUMBER);
INSERT INTO emp VALUES (1, 300, 30);
INSERT INTO emp VALUES (2, 500, 50);
COMMIT;
CREATE OR REPLACE PROCEDURE pay_bonus IS
BEGIN
UPDATE emp SET sal = sal + bonus;
END;
/
ALTER TABLE emp RENAME COLUMN bonus TO bonus_amt;Table created.
1 row created.
1 row created.
Commit complete.
Procedure created.
Table altered.BEGIN
pay_bonus;
END;
/ pay_bonus;
*
ERROR at line 2:
ORA-06550: line 2, column 3:
PLS-00905: object LAB_A.PAY_BONUS is invalid
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
Help: https://docs.oracle.com/error-help/db/ora-06550/COLUMN object_name FORMAT A10
COLUMN status FORMAT A8
COLUMN reason FORMAT A30
SELECT object_name, object_type, status FROM user_objects WHERE object_name = 'PAY_BONUS';
SELECT line, position, REGEXP_SUBSTR(text, '"[^"]+": .*') AS reason FROM user_errors WHERE name = 'PAY_BONUS' AND text LIKE '%ORA-%';OBJECT_NAM OBJECT_TYPE STATUS
---------- ------------------------------ --------
PAY_BONUS PROCEDURE INVALID
1 row selected.
LINE POSITION REASON
---------- ---------- ------------------------------
3 30 "BONUS": invalid identifier
1 row selected.user_objects shows the procedure as INVALID, and user_errors shows why: line 3 of the procedure, "BONUS": invalid identifier. The error is inside the called object, not in your block.
CREATE OR REPLACE PROCEDURE pay_bonus IS
BEGIN
UPDATE emp SET sal = sal + bonus_amt;
END;
/
COLUMN object_name FORMAT A10
COLUMN status FORMAT A8
SELECT object_name, status FROM user_objects WHERE object_name = 'PAY_BONUS';Procedure created.
OBJECT_NAM STATUS
---------- --------
PAY_BONUS VALID
1 row selected.PLS-00905 does not tell you why the object is invalid. Look at user_errors for that object (or SHOW ERRORS PROCEDURE name in SQL*Plus) and fix the object, not the caller.
BEGIN
pay_bonus;
END;
/
SELECT emp_id, sal FROM emp ORDER BY emp_id;
ROLLBACK;PL/SQL procedure successfully completed.
EMP_ID SAL
---------- ----------
1 330
2 550
2 rows selected.
Rollback complete.06PL/SQL: ORA-00942 — a table in another schema
The table emp belongs to LAB_B, and LAB_A has SELECT on it. But the block used just emp, so it looked for LAB_A's own table. The SQL inside PL/SQL failed with PL/SQL: ORA-00942: table or view does not exist.
all_tab_privs showed LAB_B EMP SELECT. Writing lab_b.emp fixed it: count = 2.
Setup
CREATE TABLE emp (emp_id NUMBER PRIMARY KEY, sal NUMBER);
INSERT INTO emp VALUES (1, 300);
INSERT INTO emp VALUES (2, 500);
COMMIT;
GRANT SELECT ON emp TO lab_a;Table created.
1 row created.
1 row created.
Commit complete.
Grant succeeded.SET SERVEROUTPUT ON
DECLARE
v_cnt NUMBER;
BEGIN
SELECT COUNT(*) INTO v_cnt FROM emp;
DBMS_OUTPUT.PUT_LINE('count = ' || v_cnt);
END;
/ SELECT COUNT(*) INTO v_cnt FROM emp;
*
ERROR at line 4:
ORA-06550: line 4, column 35:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 4, column 3:
PL/SQL: SQL Statement ignored
Help: https://docs.oracle.com/error-help/db/ora-06550/COLUMN table_schema FORMAT A12
COLUMN table_name FORMAT A10
COLUMN privilege FORMAT A10
SELECT table_schema, table_name, privilege FROM all_tab_privs WHERE table_name = 'EMP' AND grantee = 'LAB_A';TABLE_SCHEMA TABLE_NAME PRIVILEGE
------------ ---------- ----------
LAB_B EMP SELECT
1 row selected.all_tab_privs shows LAB_A can read EMP, but its owner is LAB_B. So the table exists and the grant is there; only the owner was missing from the name.
A PL/SQL: ORA-xxxxx line means a SQL statement inside the block failed to compile. Solve it like the normal ORA- error. A synonym also works instead of the owner prefix.
SET SERVEROUTPUT ON
DECLARE
v_cnt NUMBER;
BEGIN
SELECT COUNT(*) INTO v_cnt FROM lab_b.emp;
DBMS_OUTPUT.PUT_LINE('count = ' || v_cnt);
END;
/count = 2
PL/SQL procedure successfully completed.07PLS-00302: the procedure is in the package body but not the spec
order_pkg had cancel_order in its body, but the package specification only listed create_order. Calling order_pkg.cancel_order(7) from outside failed at line 2, column 13 with PLS-00302: component 'CANCEL_ORDER' must be declared. A procedure that is only in the body is private to the package.
After adding PROCEDURE cancel_order(p_id IN NUMBER); to the spec and recompiling the body, the same call printed cancelled 7.
Setup
CREATE OR REPLACE PACKAGE order_pkg AS
PROCEDURE create_order(p_id IN NUMBER);
END order_pkg;
/
CREATE OR REPLACE PACKAGE BODY order_pkg AS
PROCEDURE create_order(p_id IN NUMBER) IS
BEGIN
DBMS_OUTPUT.PUT_LINE('created ' || p_id);
END;
PROCEDURE cancel_order(p_id IN NUMBER) IS
BEGIN
DBMS_OUTPUT.PUT_LINE('cancelled ' || p_id);
END;
END order_pkg;
/Package created.
Package body created.BEGIN
order_pkg.cancel_order(7);
END;
/ order_pkg.cancel_order(7);
*
ERROR at line 2:
ORA-06550: line 2, column 13:
PLS-00302: component 'CANCEL_ORDER' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
Help: https://docs.oracle.com/error-help/db/ora-06550/COLUMN object_name FORMAT A10
COLUMN procedure_name FORMAT A14
SELECT object_name, procedure_name FROM user_procedures WHERE object_name = 'ORDER_PKG' AND procedure_name IS NOT NULL;
SELECT COUNT(*) AS body_lines FROM user_source WHERE name = 'ORDER_PKG' AND type = 'PACKAGE BODY' AND UPPER(text) LIKE '%PROCEDURE CANCEL_ORDER%';OBJECT_NAM PROCEDURE_NAME
---------- --------------
ORDER_PKG CREATE_ORDER
1 row selected.
BODY_LINES
----------
1
1 row selected.user_procedures lists only what the spec declares: just CREATE_ORDER. user_source still finds PROCEDURE CANCEL_ORDER once in the package body, so it exists but is private.
CREATE OR REPLACE PACKAGE order_pkg AS
PROCEDURE create_order(p_id IN NUMBER);
PROCEDURE cancel_order(p_id IN NUMBER);
END order_pkg;
/
ALTER PACKAGE order_pkg COMPILE BODY;Package created.
Package body altered.PLS-00302 also appears for a misspelled procedure or record field name, so compare the name in the message with the package spec.
SET SERVEROUTPUT ON
BEGIN
order_pkg.cancel_order(7);
END;
/cancelled 7
PL/SQL procedure successfully completed.FAQ
What does ORA-06550 mean?
A PL/SQL block failed to compile. The line right below it (PLS-xxxxx or PL/SQL: ORA-xxxxx) is the cause; ORA-06550 only gives the line and column.
Which line is 'line 5' in ORA-06550?
The 5th line of the PL/SQL block, counting DECLARE (or BEGIN) as line 1. In this lab, line 5 was the DBMS_OUTPUT.PUT_LINE call with the typo.
How do I fix PLS-00103 Encountered the symbol?
Check the line before the reported position for a missing ;. Here a missing ; after a declaration was reported at the next line's BEGIN.
How do I fix PLS-00428 an INTO clause is expected in this SELECT statement?
Add INTO variable to the SELECT inside the PL/SQL block. In this test SELECT sal FROM emp ... failed inside BEGIN ... END, and SELECT sal INTO v_sal FROM emp ... worked.
How do I fix PLS-00306 wrong number or types of arguments?
Compare your call with user_arguments for that procedure, then pass every required parameter in the right order and type.
How do I fix PLS-00302 component must be declared?
Check that the name in the message is declared where you call it. Here the procedure existed only in the package body; adding it to the package spec fixed it.
How do I fix PLS-00905 object is invalid?
The object you call failed to compile, often because a table or column it uses changed. Check SELECT line, text FROM user_errors WHERE name = 'NAME', fix the object, and recompile it. In the test, the error was a renamed column ("BONUS": invalid identifier).
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0