solidDB Help : solidDB reference : SQL: Statements : Hints : UNION FOR OR
  
UNION FOR OR
The UNION FOR OR hint instructs the SQL interpreter to replace an OR condition of style A = 1 OR A = 2 with a construction of the following type:
SELECT ... WHERE A = 1
UNION ALL SELECT ... WHERE A = 2
In most cases the SQL interpreter performs the replacement automatically; the UNION FOR OR hint ensures the UNION-type execution is used always.
Note Conditions of type A = 1 OR B = 2 can also be handled, but this can be problematic since the conditions are not mutually exclusive. Because of this, A = 1 OR B = 2 uses the following construction:
SELECT ... WHERE A = 1
UNION ALL SELECT ... WHERE B = 2 AND UtoT NOT (A = 1)
where UtoT stands for UNKNOWN TO TRUE.
The UtoT operator is needed for handling cases with NULL values. Without the UtoT operator, a row which has values A = NULL and B = 2 would not appear correctly in the UNION variant.
Example:
SELECT
--(* vendor(SOLID), product(Engine), option(hint)
-- UNION FOR OR *)--
* FROM HIER H1, HIER H2
WHERE H1.P=H2.C OR H1.P=H2.P;
Go up to
Hints