---
title: "TO_HEX"
description: "La funci\u00F3n SQL TO_HEX convierte un BLOB en un texto en notaci\u00F3n hexadecimal."
language: es
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/es/docs/invantive-universalsql/grammar/sql-functions/to-hex
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/to-hex
updated: 2026-12-04T14:38:06Z
license: https://documentation.invantive.eu/es/
---

## Sintaxis
```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))
```

## Propósito
La función SQL `TO_HEX` convierte un `blob` en texto en notación hexadecimal.

Véanse también [[ASCII_TO_BLOB]], [[BLOB_TO_TEXT]] y [[HEX_TO_BLOB]].

Parámetros:
- Entrada (`blob`): valor que se va a convertir a notación hexadecimal.

Resultado: la imagen `blob` se convierte en texto en notación hexadecimal como `varchar2`.

## Ejemplos
El siguiente ejemplo obtiene la notación hexadecimal de un GUID:
```sql
select to_hex(newid())

--------------------------------------
cde6acae957b492ea304bfd8692f1ace
```
El siguiente ejemplo recupera la notación hexadecimal de una variante comprimida con GZIP del carácter ASCII de un solo byte `x`:
```sql
select to_hex(gzip('eA=='))

--------------------------------------
1F8B0800E4BF266A00FFAB00008316DC8C01000000
```

