SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
S-24
Considerations—SELECT
The result of UNION is a table that contains rows belonging to either of the two
tables. If you specify UNION ALL, the table contains all the rows retrieved by each
SELECT statement; otherwise, duplicate rows are removed.
The number of columns in the table is the same as the number of columns in each
select-list. The column names in the table are the same as the corresponding
names in the select-list of the leftmost SELECT statement. A column resulting
from the UNION or expressions or constants has the name EXPR. For the
characteristics of data in the individual columns, see Considerations for UNION on
page S-25.
A UNION operation is not allowed with SELECT INTO.
If the UNION of SELECT statements is part of a view definition or a cursor
declaration, the view or cursor cannot be updated.
FOR UPDATE OF column [ , column ] ...
(only for dynamic SQL statements that are not subqueries) associates a list of
updateable columns with the statement so that a cursor can be declared for the
statement.
Considerations—SELECT
SELECT requires authority to read all views and tables referred to in the statement,
including the underlying tables of all shorthand views referred to in the statement.
Queries on audited tables or on audited or mixed views must be performed in a
TMF transaction unless the SELECT statement specifies BROWSE ACCESS. For
more information, see TMF Transactions on page T-6.
A view can be considered a select specification saved in a catalog. When a view is
referenced in a SELECT statement or a subquery, the select specification that
defines the view is combined with the statement or the subquery. The combination
can cause the SELECT statement or the subquery to be invalid.
If you receive an error message that indicates a problem but your SELECT
statement or subquery appears valid, check the view definition. For example, a
view named AVESAL includes column A defined as AVG(X). A SELECT statement
that contains MAX(A) in its select list is invalid because the select list actually
contains MAX (AVG(X)), and a function cannot have an argument that includes
another function.
To determine if a query using functions and GROUP BY clauses is valid, use
SQLCI to query the view definition in the TEXT column of the VIEWS catalog table,
as shown:
>> SET VARCHAR_WIDTH 225; Sets wide report line
>> SELECT TEXT FROM $v.sv.VIEWS From VIEWS table
+> WHERE VIEWNAME = "view-name"; Fully qualified name in
uppercase letters