PROMPT

functionnot supportedAI & MLpreview

docs.snowflake.com ↗

Semi-structured and structured data functions

The PROMPT function constructs a structured OBJECT containing a template string and a list of arguments. This object is useful for dynamically formatting messages, constructing structured prompts, or storing formatted data for further processing, such as by Cortex AI functions.

Syntax

supportedpartialnot supportednot scored

SELECT PROMPT('<template_string>', <expr_1> [ , <expr_2>, ... ] )
    FROM <table>;

Parameters

NameRequiredDescription
template_stringrequiredA string containing numbered placeholders like {0} where the number is at least 0 and less than the number of expressions specified. The first expression is substituted for {0}, the second for {1}, and so on.
expr_1 [ , expr_2, ... ]requiredExpressions whose values will eventually be substituted into the template string in place of the numbered placeholders. These can be column names or other expressions. Values can be of any type coercible to a string (for example, VARCHAR, NUMBER, etc.), or FILE.

Returns

A SQL OBJECT with the following structure: The args array contains the value of the expressions specified in the PROMPT function call.

Usage notes