WITH (common_table_expression)
Valid in: SQL, ESQL, DBProc, OpenAPI, ODBC, JDBC, .NET
A Common Table Expression (CTE) is a temporary named result set, derived from a simple query and defined within the execution scope of a SELECT or INSERT statement. It is like a derived table or inline view.
CTEs can appear in the following contexts:
• SELECT
• CREATE TABLE…AS SELECT
• DECLARE GLOBAL TEMPORARY TABLE…AS SELECT
• INSERT INTO…SELECT
• CREATE VIEW
For more information and examples, see
Common Table Expressions (CTEs) (on page
Common Table Expressions (CTEs)).
Last modified date: 08/28/2024