1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | create or replace package test_md5 as function fn_getmd5(p_str in varchar2) return varchar2; function fn_checkuser(p_username in varchar2,p_password in varchar2) return number; end; create or replace package body test_md5 as function fn_getmd5(p_str in varchar2) return varchar2 as begin return DBMS_OBFUSCATION_TOOLKIT.MD5( input_string => Upper(p_str) ); end; function fn_checkuser(p_username in varchar2,p_password in varchar2) return number is l_password varchar(1000); begin select password into l_password from test_user where upper(username)=upper(p_username) and password=Test_MD5.FN_GetMD5(p_password); if l_password is null Then return 0; else return 1; end if; exception when NO_DATA_FOUND then return 3; end; end; |
1 2 3 4 5 6 7 | Delete Test_User; Insert Into Test_User Values('A',Test_MD5.FN_GetMD5('aa')); Insert Into Test_User Values('B',Test_MD5.FN_GetMD5('bb')); select * from test_user; Select Test_MD5.FN_CheckUser('a','aa') From Dual; Select Test_MD5.FN_CheckUser('a','bb') From Dual; select * from Test_User t where t.password=test_md5.fn_getmd5('aa') |
欢迎光临 度量快速开发平台-专业、快速的软件定制快开平台 (http://bbs.delit.cn/) | Powered by Discuz! X3.2 |