---
title: "ZLIB_COMPRESS"
description: "ZLIB_COMPRESS SQL \u95A2\u6570\u306F\u3001Zlib \u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u3092\u4F7F\u7528\u3057\u3066 BLOB \u3092\u5727\u7E2E\u3057\u307E\u3059\u3002"
language: ja
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ja/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:58:01Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```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))
```

## 目的
`ZLIB_COMPRESS` SQL 関数は、Zlib アルゴリズムを使用して `blob` を圧縮します。

関連項目：[[ZLIB_DECOMPRESS]]および[[GZIP]]。

パラメータ:
- input (`blob`): 圧縮する `blob`。

戻り値: 入力の Zlib 圧縮版。

## 例
次の例では、ASCII 文字 `ACME` の9文字を圧縮して解凍し、元のテキストを取得します:
```sql
select blob_to_text(zlib_decompress(zlib_compress(ascii_to_blob('ACME'))))

-------------------
ACME
```
次の例では、テキストを圧縮し、圧縮された `blob` を base64 でエンコードしたものを取得します:
```sql
select base64_encode(zlib_compress('VGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRvIHRlc3QgdGhlIFpMaWIgY29tcHJlc3Npb24gbWV0aG9k'))

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

