LUHN_CHECK

All functions > STRING > LUHN_CHECK

Validates a string using the Luhn algorithm (modulus 10 checksum).

Syntax

LUHN_CHECK(expr)
sql

Arguments

ParameterTypeRequiredDescription
stringVARCHARYesString 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

Examples

Last update at: 2025/10/13 10:23:46