Set Operator Rules

Set operators are used to combine the records from multiple SELECT statements. The set operator is placed between the two SELECT statements. The operator tells Oracle how the records that each of the SELECT statements retrieves must be merged, compared, or discarded until one virtual table is created. The entire virtual record from each record set is evaluated against each other; therefore, the following rules apply:

  1. Each of the SELECT clauses must have the same number of expressions.

  2. Each expression in the SELECT clause must have the same data type as the corresponding expression in the other SELECT clauses.

  3. Each SELECT statement is part of one overall statement. The minor SELECT statements may have all of the SELECT clauses ...

Get Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.