In PL/SQL V1, you could define the same subprogram in a package as two different data types: VARCHAR2 and a RECORD type. This is called overloading the subprogram. If you then passed a NULL value to an overloaded subprogram, PL/SQL assumed a data type of VARCHAR2. However, versions after V1, a NULL value passed to an overloaded subprogram within a package must have a defined type.
To preserve V1 behavior, the PL/SQL conversion utility takes one of the following actions, as appropriate, when it encounters a NULL passed to an overloaded subprogram:
If you pass a NULL value to an overloaded program unit without defining the desired data type, the compiler generates this error message:
ERROR 307: Too many declarations of ‘PU name’ match this call . . .
The conversion utility converts this PL/SQL V1 code:
PACKAGE ps1 IS
TYPE foo IS RECORD(id PLS_INTEGER);
Subprogram p is overloaded::
PROCEDURE p(a VARCHAR2); a
is defined as a variable of type VARCHAR2
PROCEDURE p(a FOO); a
is also defined as another data typeEND;
PROCEDURE foo2 IS
BEGIN
ps1.p(NULL); In PL/SQL V1, the VARCHAR2
datatype is assumed.
END;
PACKAGE ps1 IS
TYPE foo IS RECORD(id PLS_INTEGER);
PROCEDURE p(a VARCHAR2);
PROCEDURE p(a FOO);
END;
PROCEDURE foo2 IS
BEGIN
ps1.p(TO_CHAR(NULL));
Since a
is type VARCHAR2, the NULL
value is wrapped with TO_CHAR( )END;