Oracle 用户密码过期后不允许修改密码的示例代码
程序员文章站
2024-02-15 14:23:40
...
--本人是初学者,不知道还有没有更好的方法
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;
以上就是Oracle 用户密码过期后不允许修改密码的示例代码的内容,更多相关内容请关注PHP中文网(www.php.cn)!