Entering content frame

QUERY statement 

A QUERY statement specifies a result table that can be ordered (see result table name). There are four different ways of formulating a QUERY statement.

Syntax

<query_statement> ::= <declare_cursor_statement> | <recursive_declare_cursor_statement>
| <named_select_statement> | <select_statement>

declare_cursor_statement, recursive_declare_cursor_statement, named_select_statement, select_statement

Explanation

A QUERY statement generates a named/unnamed result table.

A distinction is made between the following QUERY statements:

Basic types of QUERY statement

 

DECLARE CURSOR statement

A named result table is defined. The table is generated with an OPEN CURSOR statement.

Recursive DECLARE CURSOR statement

This statement can be used to generate bills of material.

SELECT statement ( named_select_statement )

A named result table is defined and generated.

SELECT statement ( select_statement )

An unnamed result table is defined and generated.

 

The SELECT statement ( named_select_statement ) and SELECT statement ( select_statement ) are subject to the rules that were specified for the DECLARE CURSOR statement and those that were specified for the OPEN CURSOR statement.

The order of rows in the result table depends on the internal search strategies of the system and is arbitrary. The only reliable means of sorting the result rows is to specify an ORDER clause.

Updateable result table

A result table or the underlying base tables are updateable if the query statement satisfies the following conditions:

Leaving content frame