Oracle and DB2, Comparison and Compatibility/Storage Model/Data Types/DB2

From Wikibooks, open books for an open world
Jump to navigation Jump to search

DB2[edit | edit source]

Character Data Types


If the length of the character data varies significantly, VARCHAR is more efficient because CHAR will pad the field with blanks to the length of CHAR(n). These blanks will be transmitted across the network. If the size of actual data does not vary much, CHAR is more efficient since each VARCHAR field has a few bytes of length information.

Numeric Data Types
Date Data Types


DB2 has a series of special registers that are storage areas that can be referenced in SQL statements. CURRENT TIMEZONE specifies the TIMEZONE parameter in the form of a time duration with a data type of DECIMAL(6,0) in the format HHMMSS. The time duration is derived by the instance that executes the SQL statement. To get the CURRENT TIME or CURRENT TIMESTAMP adjusted to GMT/UTC, subtract the CURRENT TIMEZONE register from the CURRENT TIME or TIMESTAMP.

The assumption is that the clock is set to local time and the TIMEZONE parameter is zero, or the clock is set to GMT and the TIMEZONE parameter gives the difference from GMT.

LOB Data Types
Graphic Data Types


ROWID Data Type
XML Data Type