Oracle and DB2, Comparison and Compatibility/Storage Model/Data Types/DB2
DB2
[edit | edit source]
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.
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.