Depends how you plan to use this function, but I don't like using "magic" return values, as it's easier and more maintainable to use the existing PL/SQL exception constructs, just as you would in
Java.
If you want to raise an exception within the PL/SQL (which may result in a Java exception that you can trap eventually), then you can either raise an existing pre-defined exception e.g.
You would then either let this exception propagate back to your calling function and handle it there somehow, or you could handle it within the function e.g.
Alternatively, you can
define your own exception in PL/SQL and handle it how you want.