Type: Scalar function

Takes a reference number and returns its OCR number representation by appending a mandatory integrity check digit, and optionally also a length check digit.

An OCR number is not allowed to have more than 25 digits.

Return value: varchar

If the reference number is either NULL or of the wrong length or if it contains any character that is not a digit then the function will return NULL.


@ReferenceNumber mandatory varchar
@IncludeLengthCheckDigit mandatory bit