## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> TO_HEX[TO_HEX]:::quoted TO_HEX --> End((END)) ``` ## Purpose The `TO_HEX` SQL function converts a BLOB into a text in hexadecimal notation. See also [[ASCII_TO_BLOB]], [[BLOB_TO_TEXT]] and [[HEX_TO_BLOB]]. Parameters: - Input (`blob`): value to convert to hexadecimale notation. Returns: the BLOB converted to a text in hexadecimal notation as a `varchar2`. ## Examples The following example retrieves the hexadecimal notation of a GUID: ```sql select to_hex(newid()) -------------------------------------- cde6acae957b492ea304bfd8692f1ace ``` The following example retrieves the hexadecimal notation of a GZIP-compressed variant of the single byte ASCII character `x`: ```sql select to_hex(gzip('eA==')) -------------------------------------- 1F8B0800E4BF266A00FFAB00008316DC8C01000000 ```