---
title: "Agrega\u010Dn\u00ED funkce Zip"
description: "Skupinov\u00E1 funkce, kter\u00E1 zkombinuje bin\u00E1rn\u00ED dokumenty skupiny do jednoho archivu ZIP."
language: cs
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/cs/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:49:52Z
license: https://documentation.invantive.eu/cs/
---

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

## Účel
Skupinová funkce, která zkombinuje binární dokumenty skupiny do jednoho archivu ZIP. První výraz poskytuje binární obsah (`blob`) každého dokumentu; druhý výraz poskytuje název souboru dokumentu v archivu. Výskyty obsahu `null` jsou přeskočeny; pokud jsou přítomny pouze obsahy `null`, výsledkem je `null`.

Vrací: archiv ZIP jako `blob`.

## Příklady
Následující příklad zkombinuje faktury ve formátu PDF všech zákazníků do jednoho archivu ZIP, například pro předání auditorovi; výsledkem je jeden `blob` obsahující soubor pro každou fakturu:
```sql
select zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc
```
Následující příklad zkombinuje faktury ve formátu PDF pro každého zákazníka do samostatného archivu ZIP pro každého zákazníka, například aby každému zákazníkovi poslal kopii otevřených faktur, a pojmenuje každý archiv podle zákazníka:
```sql
select ivc.customer_name
,      zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc
group
by     ivc.customer_name
```

