All Products
Search
Document Center

MaxCompute:UNHEX

Last Updated:May 26, 2025

Converts a hexadecimal string into a string. This function is an additional function of MaxCompute V2.0.

Syntax

BINARY UNHEX(STRING <number>)

Parameters

number: required. A hexadecimal string.

Return value

A value of the BINARY type is returned. The return value varies based on the following rules:

  • If the value of number is 0, an error is returned.

  • If the value of number is null, null is returned.

Examples

-- The return value is abc. 
SELECT UNHEX('616263');
-- The return value is abc. 
SELECT UNHEX(616263);
-- The return value is null. 
SELECT UNHEX(null);

Related functions

UNHEX is a mathematical function. For more information about functions related to data computing and conversion, see Mathematical functions.