How to use sql to realize 18-bit ID Card Verification
This article shows you how to use sql to achieve 18-bit ID card verification, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.
The calculation method of ID Card check Code
1. Multiply the 17 digits of the ID card number by different coefficients. The number corresponding to bit I is [2 ^ (18muri)] mod11. The coefficients from the first to the 17th are: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
2. Add the 17 digits to the result of multiplying the coefficients.
3. Add and divide by 11 to see what the remainder is.
4. The remainder can only have 11 numbers: 0 1 2 3 4 5 6 7 8 9 10. The corresponding number of the last ID card is 1 0 X 9 8 7 6 5 4 3 2.
The code is as follows:
With t as (select '34052419800101001X'id from dual) select idfrom twhere exists (select 1from dual connect by level