since the exception is defined within B the calling procedure cannot see it.
You can create a package with your exceptions, then B would raise errorpackage.user_def and the calling procedure can check WHEN errorpackage.user_def.
CREATE OR REPLACE PACKAGE my_errors
c_user_defined CONSTANT INTEGER := -20500;
PRAGMA EXCEPTION_INIT (e_user_defined, -20500);
Now you can
and check for
WHEN my_errors.e_user_defined THEN
And your exception will be associated with SQLCODE -20500
See also PL/SQL 101 : Exception Handling
> Can I catch "USER_DEF" Exception which I have defined in the PROC B in the calling PL/SQL block ?
Yes - provided that the exception is declared somewhere that is in scope to both blocks.
PROCEDURE procedure_name IS
WHEN exception_name THEN