---
title: "TO_HEX"
description: "SQL-funktionen TO_HEX konverterer en BLOB til en tekst i hexadecimal notation."
language: da
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/da/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/da/
---

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

## Formål
SQL-funktionen `TO_HEX` konverterer en `blob` til en tekst i hexadecimal notation.

Se også [[ASCII_TO_BLOB]], [[BLOB_TO_TEXT]] og [[HEX_TO_BLOB]].

Parametre:
- Input (`blob`): værdi, der skal konverteres til hexadecimal notation.

Returnerer: `blob` konverteret til en tekst i hexadecimal notation som en `varchar2`.

## Eksempler
Følgende eksempel henter den hexadecimale notation af en GUID:
```sql
select to_hex(newid())

--------------------------------------
cde6acae957b492ea304bfd8692f1ace
```
Følgende eksempel henter den hexadecimale notation af en GZIP-komprimeret variant af det enkelte ASCII-tegn `x` i én byte:
```sql
select to_hex(gzip('eA=='))

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

