Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime 13.3 LTS and above
Returns true if numStr passes the Luhn algorithm check.
The Luhn algorithm is used for example, to validate creditcard numbers.
Syntax
luhn_check(numStr)
Arguments
numStr: An STRING expression composed of digits'0'through'9'.
Returns
A BOOLEAN.
If numStr contains any character that is not a digit the result is false.
If the input's last digit matches the algorithm the result is true
Examples
> SELECT luhn_check('12345');
false
> SELECT luhn_check('12344');
true
> SELECT luhn_check('1234 4');
false