SYSTEM$QUERY_REFERENCE

functionnot supportedNative apps, listings & sharing

docs.snowflake.com ↗

System functions

Returns a query reference that you can pass to a stored procedure. Within the stored procedure, when you execute the query, the query is performed using the role of the user who created the query reference. Note As an alternative to calling this function, you can use the TABLE keyword, if you want the reference to be valid for the scope of the call (rather than for the entire session). See Using the TABLE keyword to create a reference to a table, view, or query.

Syntax

supportedpartialnot supportednot scored

SYSTEM$QUERY_REFERENCE('<select_statement>', [ , <use_session_scope> ] )

Parameters

NameRequiredDescription
select_statementrequiredThe SELECT statement to pass to the stored procedure. This must be a statement that serves as an inline view. Note that if the SELECT statement contains any single quotes or other special characters (e.g. newlines), you must escape those characters with backslashes.
use_session_scopeoptionalIf TRUE, specifies that the query reference should be valid for the duration for the session. If this is FALSE or omitted, the query reference is valid within the context in which it was created. See Specifying the scope of the reference. Default value: FALSE

Returns

A query reference that represents the specified SELECT statement.

See also

Referenced by