invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

TO_HEX

Syntax

%%{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 hexadecimal 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:

select to_hex(newid())

--------------------------------------
cde6acae957b492ea304bfd8692f1ace

The following example retrieves the hexadecimal notation of a GZIP-compressed variant of the single byte ASCII character x:

select to_hex(gzip('eA=='))

--------------------------------------
1F8B0800E4BF266A00FFAB00008316DC8C01000000