CRC32

更新时间:
复制 MD 格式

Calculates the CRC-32 checksum of a STRING or BINARY value and returns the result as a BIGINT.

Syntax

bigint crc32(string|binary <expr>)

Parameters

ParameterRequiredTypeDescription
exprYesSTRING or BINARYThe value to compute the CRC-32 checksum for.

Return value

Returns a BIGINT. The return value depends on the input:

  • If expr is null, null is returned.

  • If expr is an empty string, 0 is returned.

Examples

Calculate the CRC-32 checksum of the string ABC:

-- Returns 2743272264.
select crc32('ABC');

Pass null as the input:

-- Returns null.
select crc32(null);

Related functions

For related functions, see Other functions.