With Clause: Single Alias

Description: The WITH query_name clause provides a way assign a name to a subquery block. The subquery block can then be referenced in multiple places in the query by specifying the query name. The query is optimized by treating it as either an inline view or as a temporary table.

WITH <alias_name> AS (subquery_sql_statement)
     SELECT <column_name_list> FROM <alias>;
     WITH xyz AS (SELECT dummy FROM dual)
SELECT dummy FROM xyz;

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.