---
schema_version: "1"
id: 3d8cd7cd3afca32403e6867cf20dc4bc425c810c1305a040debbf5d269ce176c
title: 통과 함수(RAWSQL)
collection: tableau
version: next
locale: ko-kr
portal_url: https://docs.salesforce.com/tableau/next/ko-kr/public/desktop/functions_functions_passthrough.md
canonical_url: https://help.tableau.com/v0.0/public/desktop/ko-kr/functions_functions_passthrough.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 3d0f77335da42c5a5eb34419015ed4246022f69ac43176a989d47819c55c860d
description: Reference for RAWSQL pass-through functions that send SQL directly to the database.
---
[주요 콘텐츠로 건너뛰기](#main-content)

# 통과 함수(RAWSQL)

RAWSQL 통과 함수는 Tableau의 선행 해석 없이 SQL 식을 데이터베이스로 바로 보냅니다. Tableau에서 모르는 사용자 지정 데이터베이스 함수가 있는 경우 통과 함수를 사용하여 이러한 사용자 지정 함수를 호출할 수 있습니다.

Tableau에서 식을 해석하지 않기 때문에 필요한 경우 집계를 정의해야 합니다. 집계된 식을 전달해야 할 경우 함수의 `RAWSQLAGG` 버전을 사용할 수 있습니다.

RAWSQL 통과 함수는 페더레이션(서로 다른 데이터베이스에서 결합됨)되거나 게시된 데이터 원본에서 작동하지 않을 수 있습니다.

## RAWSQL 구문

RAWSQL 함수에는 집계 해제된 함수와 집계된 함수의 두 가지 유형이 있습니다. 이는 _RAWSQL_ 또는 _RAWSQLAGG_처럼 함수 이름의 첫 번째 부분에 지정됩니다. _BOOL_, _STR_, _INT_ 등 함수 이름의 마지막 부분은 출력 형식입니다. 모든 RAWSQL 함수에서 인수는 `"sql_expr", [arg1], ...[arg2]`입니다. 함수를 작성할 때 대체 구문인 `%n`을 사용하여 올바른 필드명이나 식을 삽입할 수 있습니다.

### %n 대체 구문

데이터베이스는 일반적으로 Tableau에 표시된 필드명을 이해하지 못합니다. 통과 함수의 SQL 식을 Tableau에서 해석하지 않기 때문에 Tableau 필드명을 식에 사용하면 오류가 발생할 수도 있습니다. `%n`을 사용하여 Tableau 계산에 올바른 필드명 또는 식을 통과 SQL에 삽입할 수 있습니다.

예를 들어 값 집합의 중앙값을 계산하는 함수가 있는 경우 다음과 같이 Tableau 열 \[Sales\]에서 해당 함수를 호출할 수 있습니다.

RAWSQLAGG\_REAL("MEDIAN(%1)", \[Sales\])

- `REALSQLAGG` - 집계를 지정하기 위해 사용합니다.
- `REAL` - 출력이 숫자이고 반드시 정수일 필요는 없기 때문에 사용합니다.
- `MEDIAN` - 집계 유형입니다.
- `%1`은 `[Sales]`의 자리 표시자입니다.

## RAWSQL 함수

SQL 식은 기초 데이터베이스에 바로 전달됩니다. SQL 식의 %n을 데이터베이스 값의 대체 구문으로 사용합니다.

Tableau에서 다음 RAWSQL 함수를 사용할 수 있습니다.

### RAWSQL\_BOOL

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_BOOL("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>부울</td></tr><tr><td>정의</td><td>주어진 SQL 식의 부울 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQL_BOOL("%1 &gt; %2", [Sales], [Profit])</pre><p>이 예에서 %1은 [Sales], %2는 [Profit]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQLAGG\_BOOL

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQLAGG_BOOL("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>부울</td></tr><tr><td>정의</td><td>주어진 집계 SQL 식의 부울 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQLAGG_BOOL("SUM( %1) &gt;SUM( %2)", [Sales], [Profit]) </pre><p>이 예에서 %1은 [Sales], %2는 [Profit]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQL\_DATE

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_DATE("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>날짜</td></tr><tr><td>정의</td><td>주어진 SQL 식의 날짜 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQL_DATE("%1", [Order Date])</pre><p>이 예에서 %1은 [Order Date]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQLAGG\_DATE

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQLAGG_DATE("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>날짜</td></tr><tr><td>정의</td><td>주어진 집계 SQL 식의 날짜 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQLAGG_DATE("MAX(%1)", [Order Date])</pre><p>이 예에서 %1은 [Order Date]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQL\_DATETIME

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_DATETIME("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>날짜/시간</td></tr><tr><td>정의</td><td>주어진 SQL 식의 날짜/시간 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQL_DATETIME("%1", [Order Date])</pre><p>이 예에서 %1은 [Order Date]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQLAGG\_DATETIME

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQLAGG_DATETIME("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>날짜/시간</td></tr><tr><td>정의</td><td>주어진 집계 SQL 식의 날짜/시간 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQLAGG_DATETIME("MIN(%1)", [Order Date])</pre><p>이 예에서 %1은 [Order Date]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQL\_INT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_INT("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>정수</td></tr><tr><td>정의</td><td>주어진 SQL 식의 정수 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQL_INT("500 + %1", [Sales])</pre><p>이 예에서 %1은 [Sales]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQLAGG\_INT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQLAGG_INT("sql_expr", [arg1,] …[argN])</code></td></tr><tr><td>출력</td><td>정수</td></tr><tr><td>정의</td><td>주어진 집계 SQL 식의 정수 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQLAGG_INT("500 + SUM(%1)", [Sales])</pre><p>이 예에서 %1은 [Sales]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQL\_REAL

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_REAL("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>숫자</td></tr><tr><td>정의</td><td>주어진 SQL 식의 숫자 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre>RAWSQL_REAL("-123.98 * %1", [Sales])</pre><p>이 예에서 %1은 [Sales]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQLAGG\_REAL

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQLAGG_REAL("sql_expr", [arg1,] …[argN])</code></td></tr><tr><td>출력</td><td>숫자</td></tr><tr><td>정의</td><td>주어진 집계 SQL 식의 숫자 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQLAGG_REAL("SUM( %1)", [Sales])</pre><p>이 예에서 %1은 [Sales]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQL\_SPATIAL

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_SPATIAL("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>공간</td></tr><tr><td>정의</td><td>주어진 SQL 식의 공간 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQL_SPATIAL("%1", [Geometry])</pre><p>이 예에서 %1은(는) [Geometry]에 해당합니다.</p></td></tr><tr><td>참고</td><td>이 함수의 <code>RAWSQLAGG</code> 버전이 없습니다.</td></tr></tbody></table>

### RAWSQL\_STR

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQL_STR("sql_expr", [arg1], …[argN])</code></td></tr><tr><td>출력</td><td>문자열</td></tr><tr><td>정의</td><td>주어진 SQL 식의 문자열 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQL_STR("%1", [Customer Name])</pre><p>이 예에서 %1은 [Customer Name]에 해당합니다.</p></td></tr></tbody></table>

### RAWSQLAGG\_STR

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>구문</td><td><code>RAWSQLAGG_STR("sql_expr", [arg1,] …[argN])</code></td></tr><tr><td>출력</td><td>문자열</td></tr><tr><td>정의</td><td>주어진 집계 SQL 식의 문자열 결과를 반환합니다.</td></tr><tr><td>예</td><td><pre xml:space="preserve">RAWSQLAGG_STR("AVG(%1)", [Discount])</pre><p>이 예에서는 %1은 [Discount]에 해당합니다.</p></td></tr></tbody></table>