> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snowflake.com/llms.txt
> Use this file to discover all available pages before exploring further.

<dl>
<dt>Categories:</dt>
<dd>

[String & binary functions](/sql-reference/functions-string) (AI Functions)

</dd>
</dl>

# EXTRACT_ANSWER (SNOWFLAKE.CORTEX)

This feature is not available in the People's Republic of China.

This page is provided for backward compatibility. For new use cases, start with
%aisql-new-func-link%, which is the canonical surface going forward.
This legacy function will be deprecated by the end of 2026.

- [Snowflake Cortex AI Functions (including LLM functions)](/user-guide/snowflake-cortex/aisql)

Extracts an answer to a given question from a text document. The document may be a plain-English document or a string
representation of a semi-structured (JSON) data object.

## Syntax

```sqlsyntax
SNOWFLAKE.CORTEX.EXTRACT_ANSWER(
    <source_document>, <question>)
```

## Arguments

<dl>
<dt><code className="samp"><em>source_document</em></code></dt>
<dd>

A string containing the plain-text or JSON document that contains the answer to the question.

</dd>
<dt><code className="samp"><em>question</em></code></dt>
<dd>

A string containing the question to be answered.

</dd>
</dl>

## Returns

A string containing an answer to the given question.

## Access control requirements

Users must use a role that has been granted the [SNOWFLAKE.CORTEX_USER database role](#label-snowflake-db-roles-cortex-user).
See [](#label-cortex-llm--privileges) for more information on granting this privilege.

## Legal notices

Refer to [Snowflake AI and ML](/guides-overview-ai-features).