I have a procedure which using execute immediate changes a user password. If password is correct it passes a result (new password with some additional text) to OUT parameter .
The point is how to pass an error (like below) which is a result of password verify function to OUT parameter:
ORA-28003: password verification for the specified password failed
ORA-20004: Password should contain at least one digit, one character and one
punctuation
would you give me some hint/example ?
Below a code of my procedure:
CREATE OR REPLACE procedure SYS.SYSChangePassword(
pUsername in varchar2,
pNewPassword in varchar2,
pResult out varchar2(300)) as
begin
execute immediate 'alter user '||pUsername||' identified by "' || pNewPassword || '";';
pResult := 'New password for '|| pUsername||' has been set: '|| pNewPassword ;
end;
/
EXCEPTIONblock, within your Pl/SQL Code. That's a way for you to raise specific exceptions, based on some logic within your code. If you put your code here, it might haveEXCEPTION WHEN OTHERS THEN ....exception block, but for those specific ones, you need to declare acustom_exception EXCEPTION;and then if a certain condition is met, toRAISE custom_exception;. Finally, in the EXCEPTION block, you would have :EXCEPTION WHEN custom_exception then raise_application_error(-20001, 'You custom message goes here');. I think I exhausted it ..