---
title: "UNGZIP"
description: "The UNGZIP SQL function decompresses a blob using the GZIP-algorithm."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/ungzip
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/ungzip
updated: 2026-08-09T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> UNGZIP[UNGZIP]:::quoted
    UNGZIP --> End((END))
```

## Purpose
The `UNGZIP` SQL function decompresses a `blob` using the GZIP-algorithm.

See also [[GZIP]].

Parameters:
- input (`blob`): The `blob` to decompress. BASE64 decoding is applied automatically when a `varchar2` text is provided.

Returns: the decompressed value as `blob`.

## Examples
The following example retrieves compressed and decompressed representation of the nine ASCII characters `invantive`:
```sql
select base64_encode(ungzip(gzip('aW52YW50aXZl')))

-------------------
aW52YW50aXZl
```
The following example retrieves the single byte character `x` from its GZIP-compressed representation:
```sql
select to_char(ungzip('H4sIAHSxJmoA/6sAAIMW3IwBAAAA'))

-------------------
x
```
The following example retrieves the length of compressed and decompressed 1200 characters representing 100 times the BASE64 encoding of the nine ASCII characters `invantive`:
```sql
select length(ungzip(gzip(rpad('aW52YW50aXZl', 1200, 'aW52YW50aXZl'))))

-------------------
900
```