At most one declaration of a variable in a given scope is allowed in PL/SQL. The PLS-00371
error will be raised at runtime when
attempting to reference a variable declared more than once.
Noncompliant code example
SET SERVEROUTPUT ON
DECLARE
foo VARCHAR2(42) := 'foo';
foo VARCHAR2(42) := 'bar'; -- Non-Compliant
BEGIN
DBMS_OUTPUT.PUT_LINE(foo); -- Raises PLS-00371: at most one declaration for 'FOO' is permitted
END;
/
Compliant solution
SET SERVEROUTPUT ON
DECLARE
foo VARCHAR2(42) := 'foo';
bar VARCHAR2(42) := 'bar'; -- Compliant
BEGIN
DBMS_OUTPUT.PUT_LINE(foo);
END;
/