Copyright NOTICE: This article is the original article of the blogger, without the permission of the blogger may not be reproduced.
Common data types for DB2 include the following:
A. Digital type.
1. SMALLINT---Short integral type, the range is -32768~+32767, once used less
2. Int/integer---Integral type, 4 bytes, range is -2147483648~+2147483647, used more than once to do automatically generated sequence, or as the ID of table record use.
3. BIGINT----Large integral type, 8 bytes, precision 19 bits, large enough, generally less used.
4. Decimal (P,S)---decimal type, where P is the precision, S is the decimal digits, the implied decimals (the decimal point does not count in digits). For example, M DECIMAL (5,2), the specified m is the precision of 5 bits (except the decimal point of all digits can not be more than 5), or the insertion occurs when the data bit overflow, and the number of digits can not exceed 2, otherwise inserted will truncate decimal places.
Like what:
m:123.45 (Success)
m:12.345 (successful, but truncated to 12.34)
m:1234.5 (failure, integer digit exceeded, overflow error)
5. Real---single-precision floating-point type, not commonly used
6 double----double-precision floating-point type, not commonly used
Two. Character type
char (n)----fixed-length string, length range 1~254, commonly used
VARCHAR (n)----variable long string, length range 1~32672, commonly used
CLOB-----Character Large object string, very large, useless, to be used for further study.
Three. Time Type
Date----4 bytes Insert format ' YYYY-MM-DD '
Time----3 bytes Insert format ' HH:MM:SS '
Timestamp----10 bytes Insert format as ' Yyyy-mm-dd HH:MM:SS '
Of course, this is all in the internal format compressed.
Four. Null value
Null indicates that NULL can represent the null value of any data type, but null cannot participate in any arithmetic and logical operations, and if the calculation is null.