Was this helpful?
Check Digit Functions
Two SQL functions are used to generate and validate a check digit.
The function GENERATE_DIGIT generates a check digit for a specified string. The check digit can be used to help determine if a string, such as a credit card number, has been entered correctly.
The function VALIDATE_DIGIT tests if the check digit is valid.
Syntax for these functions is:
GENERATE_DIGIT('scheme', 'string')
which returns the check digit as a character.
VALIDATE_DIGIT('scheme', 'string')
which returns 1 for valid, 0 for invalid.
The scheme can be one of the following check digit schemes:
LUHN or LUHN_A
VERHOEFF or VERHOEFFNR
ISBN
ISBN_13
ISSN
UPC, UPC_A, or EAN_12
UPC_E
EAN, EAN_13, GTIN_13, or JAN
EAN_8 or GTIN_8
For details, see the GENERATE_DIGIT and VALIDATE_DIGIT sections under String Functions in the SQL Reference Guide.
Last modified date: 08/29/2024