LUHN_CHECK
All functions > STRING > LUHN_CHECK
Validates a string using the Luhn algorithm (modulus 10 checksum).
Syntax
LUHN_CHECK(expr)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | VARCHAR | Yes | String of digits to validate |
Returns
TRUE if the string passes the Luhn check, FALSE otherwise
Notes
- Commonly used for validating credit card numbers
- Non-digit characters (spaces, hyphens) are typically ignored
- Also known as mod 10 algorithm
- Returns FALSE for invalid input