---
title: "Product Aggregate Function (*.fnc)"
description: "\u6570\u5024\u306E\u500B\u5225\u306E\u5024\u3092\u639B\u3051\u5408\u308F\u305B\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/product-aggregate-function
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/aggregate-functions/product-aggregate-function
updated: 2026-12-04T12:48:37Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```mermaid
%%{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`データ型の範囲をすぐに超えることがあります。 積のグループ関数は、通常、1付近の値を用いる金融計算や確率計算で使用されます。 `null`の出現は無視されます。`null`の値のみが存在する場合、結果は1になります。 `ALL`(既定値)を指定すると、各値は出現した回数分だけ計上されます。`ALL`はリリース28.0から使用できます。

## 例
次の例では、顧客契約の年次インデックス係数に基づいて、累積価格インデックスを計算します。
```sql
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
```
次の例では、顧客ごとに、元の契約価格に適用する累積インデックス係数を計算します。
```sql
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
```

