Invantive 문서Invantive Cloud의 일부
Invantive 지원 포럼로그인 / 회원가입

Zip 집계 함수

구문

%%{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))

목적

여러 문서의 바이너리를 하나의 ZIP 아카이브로 결합하는 그룹 함수입니다. 첫 번째 식은 각 문서의 바이너리 내용(blob)을 제공하고, 두 번째 식은 아카이브 내 문서의 파일 이름을 제공합니다. null 내용은 건너뛰며, null 내용만 존재하는 경우 결과는 null입니다.

반환값: blob로서의 ZIP 아카이브입니다.

예시

다음 예제는 모든 고객의 송장 PDF 문서를 하나의 ZIP 아카이브로 결합합니다. 예를 들어 감사인에게 전달하기 위한 것이며, 결과는 송장마다 파일을 포함하는 하나의 blob입니다:

select zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc

다음 예제는 고객별 송장 PDF 문서를 고객마다 하나의 ZIP 아카이브로 결합합니다. 예를 들어 각 고객에게 미결 송장 사본을 보내기 위한 것이며, 각 아카이브를 고객 이름으로 명명합니다:

select ivc.customer_name
,      zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc
group
by     ivc.customer_name