我有一个使用执行立即更改用户密码的过程。如果密码正确,则会将结果(带有一些附加文本的新密码)传递给OUT参数 关键是如何将密码验证功能的结果错误(如下所示)传递给OUT参数:
ORA-28003: password verification for the specified password failed
ORA-20004: Password should contain at least one digit, one character and one
punctuation
你会给我一些提示/例子吗?
在我的程序代码下面:
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;
/
答案 0 :(得分:1)
在过程编译期间,不能为out变量varchar2(300)
指定大小。
CREATE OR REPLACE procedure SYSChangePassword(
pUsername in varchar2,
pNewPassword in varchar2,
pResult out varchar2 ) as
begin
execute immediate 'alter user '||pUsername||' identified by "' || pNewPassword || '";';
pResult := 'New password for '|| pUsername||' has been set: ' || pNewPassword ;
EXCEPTION
WHEN OTHERS THEN
pResult := SQLERRM;
end;
/
现在,您可以调用该过程并显示错误消息。
DECLARE
vResult varchar2(400);
BEGIN
SYSChangePassword (pUsername=>'HR',pNewPassword=> 'hr',pResult=>vResult );
DBMS_OUTPUT.PUT_LINE(vResult);
END;
/
答案 1 :(得分:0)
Somehing如:
b'name=test&password=tttt'