TO_HEX

Learn how to use the TO_HEX conversion function in PlaidCloud Lakehouse. For a string argument str, TO_HEX() returns a hexadecimal string representation of...

For a string argument str, TO_HEX() returns a hexadecimal string representation of str where each byte of each character in str is converted to two hexadecimal digits. The inverse of this operation is performed by the UNHEX() function.

For a numeric argument N, TO_HEX() returns a hexadecimal string representation of the value of N treated as a longlong (BIGINT) number.

Analyze Syntax

func.to_hex(<expr>)

Analyze Examples

func.to_hex('abc')

┌────────────────────┐
 func.to_hex('abc') 
├────────────────────┤
 616263             
└────────────────────┘

SQL Syntax

TO_HEX(<expr>)

Aliases

SQL Examples

SELECT HEX('abc'), TO_HEX('abc');

┌────────────────────────────┐
 hex('abc')  to_hex('abc') 
├────────────┼───────────────┤
 616263      616263        
└────────────────────────────┘

SELECT HEX(255), TO_HEX(255);

┌────────────────────────┐
 hex(255)  to_hex(255) 
├──────────┼─────────────┤
 ff        ff          
└────────────────────────┘