Oracle errors

PLS-00201: identifier must be declared

PLS-00201: identifier 'NAME' must be declared

PL/SQL cannot see the name you used. It is misspelled, not declared, in another schema without a prefix, or you lack the privilege. A privilege that comes through a role does not count inside a stored unit.

What PLS-00201 means

PL/SQL resolves every name while compiling. If a name matches nothing the owner can see, it reports PLS-00201, normally under ORA-06550. It often comes up when code that works in a worksheet fails in a procedure: roles are active in your session but not inside a definer’s-rights unit.

Common causes of PLS-00201

How to fix PLS-00201

  1. Check the spelling, and declare the variable.
  2. Prefix the owner: hr.pkg_salary.calc, or create a synonym.
  3. Grant the privilege directly to the owner of the code: GRANT EXECUTE ON hr.pkg_salary TO app_owner.
  4. Check that the object exists and is visible: ALL_OBJECTS.

PLS-00201 example

The procedure is unknown to this user:

BEGIN
  calc_bonus(1);
END;
/
-- ORA-06550: line 2, column 3:
-- PLS-00201: identifier 'CALC_BONUS' must be declared

-- Prefix the owner and grant directly
GRANT EXECUTE ON hr.calc_bonus TO app_owner;

BEGIN
  hr.calc_bonus(1);
END;
/

In SQLlightspeed

When a statement fails, SQLlightspeed’s error panel shows the error code with a plain-language explanation and a suggestion for what to do next, together with Oracle’s own message and a link to Oracle’s documentation — for this error and dozens of other common ones.

Related errors

ORA-06550PLS-00306ORA-01031 All Oracle errors →

Oracle documentation for PLS-00201. Oracle is a registered trademark of Oracle Corporation. SQLlightspeed is not affiliated with Oracle.