---
title: "ZLIB_COMPRESS"
description: "La funci\u00F3n SQL ZLIB_COMPRESS comprime un BLOB usando el algoritmo Zlib."
language: es
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/es/docs/invantive-universalsql/grammar/sql-functions/zlib-compress
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/zlib-compress
updated: 2026-12-04T14:57:52Z
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)) --> ZLIB_COMPRESS[ZLIB_COMPRESS]:::quoted
    ZLIB_COMPRESS --> End((END))
```

## Propósito
La función SQL `ZLIB_COMPRESS` comprime una imagen `blob` utilizando el algoritmo Zlib.

Véanse también [[ZLIB_DECOMPRESS]] y [[GZIP]].

Parámetros:
- Entrada (`blob`): La imagen `blob` que se va a comprimir.

Devuelve: una versión comprimida con Zlib de la entrada.

## Ejemplos
En el siguiente ejemplo se comprimen y descomprimen los nueve caracteres ASCII `ACME` y se recupera el texto original:
```sql
select blob_to_text(zlib_decompress(zlib_compress(ascii_to_blob('ACME'))))

-------------------
ACME
```
En el siguiente ejemplo se comprime un texto y se recupera la imagen comprimida `blob`, codificada en base64:
```sql
select base64_encode(zlib_compress('VGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRvIHRlc3QgdGhlIFpMaWIgY29tcHJlc3Npb24gbWV0aG9k'))

-------------------
eJwFwbkNgEAQA8BWXBAhERmPxa7E3aKzhaB7ZuZIIYUVD8eHq/oJ8zVcMGU4iGXKDXu1e1DK6mh01PEDjdMV+Q==
```

