Are you getting the ORA-06550 error when running an SQL statement? Learn the cause of this error and the solution in this article.
Demonstration of the Error
To demonstrate this error, I can run this code that creates a stored procedure:
CREATE OR REPLACE PROCEDURE testProcedure AS
textValue VARCHAR2(3);
BEGIN
textValue := someOtherValue;
END;
If I compile this procedure, I get this message:
Procedure TESTPROCEDURE compiled Errors: check compiler log
Now, I can run this procedure:
EXEC testProcedure;
Error starting at line : 8 in command - EXEC testProcedure Error report - ORA-06550: line 1, column 7: PLS-00905: object INTRO_USER.TESTPROCEDURE is invalid ORA-06550: line 1, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
As you can see, I get the error code ORA-06550: line X column X.
What caused this error?
ORA-06550 Cause
ORA-06550 is caused by a PL/SQL compilation error – an error in your PL/SQL code.
The cause of the error is actually dependent on the error it is linked to.
It’s a bit of a decoy. It says “Hey, I’ve found an error, but your actual error is over there!”
As you might notice, when you get an ORA-06550 error, it is accompanied by a second error message just below it.
You should be able to see this if you’re running SQL Developer or Toad (or many other IDEs).
Go to View > Log, and a Log window should appear.
If not, you can run the SHOW ERRORS command.
SHOW ERRORS;
Errors for PROCEDURE INTRO_USER.TESTPROCEDURE: LINE/COL ERROR -------- ------------------------------------------------------- 4/3 PL/SQL: Statement ignored 4/16 PLS-00201: identifier 'SOMEOTHERVALUE' must be declared
This will show the error message that causes this error to appear, which could be one of many errors.
ORA-06550 Solution
To resolve the ORA-06550 error, first fix the error that comes with it.
The error that comes with it is also more descriptive of the actual issue.
For example, in our example above, I also got a PLS-00201 error.
This was because I had mentioned a variable called someOtherValue but this was not declared anywhere.
To fix this, I would need to declare the variable, correct a typo if I spelt it wrong, or use another value.
Once you have fixed the error, recompile the code.
For example:
CREATE OR REPLACE PROCEDURE testProcedure AS
textValue VARCHAR2(3);
BEGIN
textValue := 'ABC';
END;
Procedure TESTPROCEDURE compiled
EXEC testProcedure;
PL/SQL procedure successfully completed.
Hopefully this article has helped you resolve the ORA-06550 error message.