forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
6.1 KiB
6.1 KiB
hex
This function is used to convert an integer or character into its hexadecimal representation.
Syntax
hex(BIGINT a)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
a |
Yes |
DOUBLE, BIGINT, DECIMAL, or STRING |
The value can be a float, integer, or string. If the value is not of the BIGINT type, the system will implicitly convert it to the BIGINT type for calculation. The string is converted to its corresponding ASCII code. |
Return Values
The return value is of the STRING type.
Example Code
The value 0 is returned.
select hex(0);
The value 61 is returned.
select hex('a');
The value 10 is returned.
select hex(16);
The value 31 is returned.
select hex('1');
The value 3136 is returned.
select hex('16');
The value NULL is returned.
select hex(null);
Parent topic: Mathematical Functions