--本人是Oracle初学者,不知道还有没有更好的方法
create table PASSWD_CHANGED
(
USER_NAME VARCHAR2(20),
OLD_PASSWD VARCHAR2(100),
NEW_PASSWD VARCHAR2(100)
)
CREATE OR REPLACE FUNCTION my_password_verify(username VARCHAR2,
password VARCHAR2,
old_password VARCHAR2)
RETURN BOOLEAN IS
v_days NUMBER(20);
BEGIN
EXECUTE IMMEDIATE 'SELECT TRUNC(expiry_date)-TRUNC(SYSDATE) FROM DBA_USERS u WHERE u.username=:username'
INTO v_days
USING username;
IF v_days < 1 THEN
raise_application_error(-20001, 'the password has expired!'||chr(10)||'Contact :13611111111');
END IF;
/*
IF LENGTH(password) < 6 THEN
raise_application_error(-20001,'Password must be at least 6 characters long');
END IF;
*/
INSERT INTO passwd_changed VALUES (username, old_password, password);
RETURN(TRUE);
END;
阅读(269) | 评论(0) | 转发(0) |