I have a stored procedure
as follows.
CREATE OR REPLACE PROCEDURE TEST(
X IN VARCHAR2 DEFAULT 'P',
Y IN NUMBER DEFAULT 1) AS
BEGIN
DBMS_OUTPUT.PUT_LINE('X'|| X||'--'||'Y'||Y);
END;
When I execute the above procedure
EXEC TEST(NULL,NULL);
It will print X--Y
. The input parameters are not defaulting to the specified values in the procedure signature when input parameters are null
.
What is the use of default
values then? What if we pass a null
value as input and we want to replace a null
value with the default
value?