Here is the solution for most common causes of Oracle PL/SQL PLS-00201 – identifier must be declared exception.
You got a PLS-00201 – identifier must be declared exception during PL/SQL program execution.
The exception occurred usually in cases:
- when you try to access undeclared variable
- when you try to execute invalid package/procedure/function
- when you try to execute package/procedure/function which does not exists
- when you try to use exception, procedure, package, function which the user does not have permission to.
3.1. You try to access undeclared variable
Check the name of the variable and ensure that it’s correct.
DECLARE v_dummy NUMBER; BEGIN v_bunny := 10; --should be v_dummy END;
3.2. You try to execute invalid package/procedure/function
Check that used objects like PL/SQL procedures/functions/packages are correct and compile them if not.
3.3. You try to execute package/procedure/function which does not exists
Check your spieling of used package/procedure/function and compare it with the package/procedure/function declaration.
BEGIN dbms_outputt.put_line('The message'); -- should be dbms_output END;
3.4. You try to use exception, procedure, package, function which the user does not have permission to.
If the object exists and the name of the object is the same as the referenced object ensure that the user has permission to execute it. Here is an example of missing permission to DBMS_AQ package.
At the end… May I ask you for something?
If I helped you solve your problem, please share this post. Thanks to this, I will have the opportunity to reach a wider group of readers. Thank You