Home > Database > Mysql Tutorial > Oracle 用户密码过期后不允许修改密码的示例代码

Oracle 用户密码过期后不允许修改密码的示例代码

PHP中文网
Release: 2017-03-31 15:22:03
Original
1160 people have browsed it

--本人是初学者,不知道还有没有更好的方法

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, &#39;the password has 
expired!&#39;||chr(10)||&#39;Contact :13611111111&#39;);
  END IF;
  /*
  IF 
LENGTH(password) < 6 THEN
  raise_application_error(-20001,&#39;Password must 
be at least 6 characters long&#39;);
  END IF;
  */
  INSERT INTO 
passwd_changed VALUES (username, old_password, password);
  RETURN(TRUE);
END;
Copy after login

 以上就是Oracle 用户密码过期后不允许修改密码的示例代码的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template