亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

用sql實現(xiàn)18位身份證校驗代碼分享 身份證校驗位計算

 更新時間:2014年01月28日 13:44:05   作者:  
這篇文章主要介紹了用SQL寫的18位身份證校驗代碼,大家參考使用吧

身份證校驗碼的計算方法

1、將前面的身份證號碼17位數(shù)分別乘以不同的系數(shù)。第i位對應(yīng)的數(shù)為[2^(18-i)]mod11。從第一位到第十七位的系數(shù)分別為:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 ;

2、將這17位數(shù)字和系數(shù)相乘的結(jié)果相加;

3、用加出來和除以11,看余數(shù)是多少?;

4、余數(shù)只可能有0 1 2 3 4 5 6 7 8 9 10這11個數(shù)字。其分別對應(yīng)的最后一位身份證的號碼為1 0 X 9 8 7 6 5 4 3 2;

復(fù)制代碼 代碼如下:

with t as(select '34052419800101001X'id from dual)
select id
from t
where exists(select 1
from dual connect by level<=length(id)-1 --17
having mod(sum(substr(id,level,1)*power(2,18-level)),11)=
case substr(id,-1,1)
when '1' then 0
when '0' then 1
when 'X' then 2
else
12-substr(id,-1,1)
end);

相關(guān)文章

最新評論