5.18 Set operations

 < Day Day Up > 



5.18 Set operations

Set operators can be used to combine result sets in both Oracle and DB2 UDB. Table 5-7 shows the differences between the products.

Table 5-7: Mapping of set operations

Oracle

DB2 UDB

UNION

UNION

UNION ALL

UNION ALL

MINUS

EXCEPT

INTERSECT

INTERSECT

DB2 UDB supports the ALL option on each operator, allowing duplicates to be preserved. Oracle allows ALL only on UNION.

Null values conversion

In Oracle, function NVL provides a conversion of NULL values to non-null values:

    NVL(TO_CHAR(MANAGER_ID),'No Manager') 

converts all of the NULL values in the manager_id column to the string: "No Manager"

In DB2, use the COALESCE function to convert nulls, as in:

    COALESCE(MANAGER_ID,'No Manager') 



 < Day Day Up > 



Oracle to DB2 UDB Conversion Guide2003
Oracle to DB2 UDB Conversion Guide2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 132

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net