---
title: "ZIP\u96C6\u8A08\u95A2\u6570"
description: "\u8907\u6570\u306E\u884C\u306E\u30D0\u30A4\u30CA\u30EA\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30921\u3064\u306EZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306B\u307E\u3068\u3081\u308B\u30B0\u30EB\u30FC\u30D7\u95A2\u6570\u3067\u3059\u3002"
language: ja
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ja/docs/invantive-universalsql/grammar/aggregate-functions/zip-aggregate-function
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/aggregate-functions/zip-aggregate-function
updated: 2026-12-04T12:50:09Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    zipAggregateFunction_start((START))
    zipAggregateFunction_start --> zipAggregateFunction_0_0[ZIP]:::quoted
    zipAggregateFunction_0_0 --> zipAggregateFunction_0_1["("]:::quoted
    zipAggregateFunction_0_1 --> zipAggregateFunction_0_2[expressionList]
    zipAggregateFunction_0_2 --> zipAggregateFunction_0_3[")"]:::quoted
    zipAggregateFunction_0_3 --> zipAggregateFunction_end((END))
```

## 目的
複数の行のバイナリドキュメントを1つのZIPアーカイブにまとめるグループ関数です。 最初の式は各ドキュメントのバイナリ内容（`blob`）を指定し、2番目の式はアーカイブ内でのドキュメントのファイル名を指定します。 `null`の内容は省略されます。`null`の内容しかない場合、結果は`null`になります。

戻り値：`blob`としてのZIPアーカイブ。

## 例
次の例では、すべての顧客の請求書PDFドキュメントを1つのZIPアーカイブにまとめています。たとえば監査人に引き渡す場合に使用できます。結果は、請求書ごとにファイルを含む1つの`blob`です。
```sql
select zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc
```
次の例では、顧客ごとの請求書PDFドキュメントを顧客ごとに1つのZIPアーカイブにまとめ、各アーカイブに顧客名を付けています。たとえば、各顧客に未払い請求書のコピーを送る場合に使用できます。
```sql
select ivc.customer_name
,      zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc
group
by     ivc.customer_name
```

