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

Product 집계 함수

구문

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    x_0_0[PRODUCT]:::quoted --> x_0_1["("]:::quoted
    x_0_1 --> x_0_2[DISTINCT]:::quoted
    x_0_1 --> x_0_2a[ALL]:::quoted
    x_0_2a --> x_0_3
    x_0_1 --> x_0_3
    x_0_2 --> x_0_3[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    x_0_3 --> x_0_4[")"]:::quoted

목적

숫자 값들을 모두 곱하는 그룹 함수입니다. 큰 값을 곱하면 결과가 decimal 데이터 타입의 범위를 빠르게 초과할 수 있습니다. product 그룹 함수는 일반적으로 1 근처의 값을 사용하는 금융 및 확률 계산에 쓰입니다. null 값은 무시되며, 모든 값이 null인 경우 결과는 1입니다. ALL이(가) 기본값이며, 각 값은 발생한 횟수만큼 계산됩니다. ALL은(는) 릴리스 28.0부터 사용할 수 있습니다.

예시

다음 예제는 고객 계약의 연간 인덱스화 계수에 걸쳐 누적 가격 인덱스화를 계산합니다:

select product(idx.factor)
from   csvtable
       ( passing 'Acme Industries#2024#1.02|Acme Industries#2025#1.03|Carlson Ltd#2024#1.05'
         row delimiter '|'
         column delimiter '#'
         columns customer_name varchar2 position next
         ,       year          number   position next
         ,       factor        number   position next
       ) idx

-------------------
1.10313

다음 예제는 고객별로 원래 계약 가격에 적용할 누적 인덱스화 계수를 계산합니다:

select idx.customer_name
,      product(idx.factor)
from   csvtable
       ( passing 'Acme Industries#2024#1.02|Acme Industries#2025#1.03|Carlson Ltd#2024#1.05'
         row delimiter '|'
         column delimiter '#'
         columns customer_name varchar2 position next
         ,       year          number   position next
         ,       factor        number   position next
       ) idx
group
by     idx.customer_name
order
by     idx.customer_name

-------------------
Acme Industries    1.0506
Carlson Ltd        1.05