SHOW_SAVED_QUERY

SHOW_SAVED_QUERY shows the query text for a previously saved query.

Read more in the Saved Queries guide.

See also: ref:save_query, EXECUTE_SAVED_QUERY, ref:drop_saved_query, ref:list_saved_queries.

Permissions

Showing a saved query requires no special permissions.

Syntax

show_saved_query_statement ::=
    SELECT SHOW_SAVED_QUERY(saved_query_name)
    ;

saved_query_name ::= string_literal

Returns

A single row result containing the saved query string.

Parameters

Parameter

Description

saved_query_name

The name of the query to show

Examples

Showing a previously saved query

t=> SELECT SAVE_QUERY('select_by_weight_and_team',$$SELECT * FROM nba WHERE Weight > ? AND Team = ?$$);
executed
t=> SELECT SHOW_SAVED_QUERY('select_by_weight_and_team');
saved_query
-----------------------------------------------
SELECT * FROM nba WHERE Weight > ? AND Team = ?