Rules for Set Operators
Duplicate Rows
By default, duplicate rows are not returned.
To permit duplicate rows to be returned, specify the ALL option. For an example, see “Retaining Duplicate Rows Using the ALL Option” on page 1151.
Operations That Support Set Operators
You can use set operators within the following operations:
Note: You cannot use the HASH BY or LOCAL ORDER BY clauses in derived tables with set operators.
SELECT statements connected by set operators can include all of the normal clause options for SELECT except the WITH clause.
SELECT AND CONSUME Statement
Set operations do not operate on SELECT AND CONSUME statements.
Support for ORDER BY Clause
A query expression can include only one ORDER BY specification, at the end.
Restrictions on the Data Types Involved in Set Operations
The following restrictions apply to CLOB, BLOB, and UDT types involved in set operations:
Data Type |
Restrictions |
BLOB |
You cannot use set operators with CLOB or BLOB types. |
CLOB |
|
UDT |
A workaround for this restriction is to use CREATE CAST to define casts that cast between the UDTs and then explicitly invoke the CAST function within the set operation. Teradata Database generates ordering functionality for distinct UDTs where the source types are not LOBs. To create an ordering definition for structured UDTs or distinct UDTs where the source types are LOBs, or to replace system-generated ordering functionality, use CREATE ORDERING. For more information on CREATE CAST and CREATE ORDERING, see SQL Data Definition Language. |