Oracle getting started Tutorial: DB2 Common Data Types

Source: Internet
Author: User
4. DECIMAL (P, S) --- DECIMAL type, where P indicates precision, S indicates DECIMAL places, and implicit DECIMAL places (DECIMAL places are not counted in digits ). For example, MDECIMAL () is the precision of M.

4. DECIMAL (P, S) --- DECIMAL type, where P indicates precision, S indicates DECIMAL places, and implicit DECIMAL places (DECIMAL places are not counted in digits ). For example, m decimal (5, 2) is the precision of M.

Common Data Types of DB2 include:

1. Digital type.

1. SMALLINT --- short integer, range:-32768 ~ + 32767, less than once

2. INT/INTEGER --- INTEGER, 4 bytes in the range of-2147483648 ~ + 2147483647, multiple times for auto-generated sequence or Table Record id.

3. BIGINT ---- big integer, 8 bytes. The precision is 19 BITs. It is large enough and generally seldom used.

4. DECIMAL (P, S) --- DECIMAL type, where P indicates precision, S indicates DECIMAL places, and implicit DECIMAL places (DECIMAL places are not counted in digits ). For example, m decimal () indicates that M is precise to 5 digits (the number of digits except the DECIMAL point cannot exceed 5 digits). Otherwise, data overflow occurs during insertion; the number of decimal places cannot exceed 2; otherwise, the decimal places are truncated during insertion.

For example:

M: 123.45 (successful)

M: 12.345 (successful, but truncated to 12.34)

M: 1234.5 (failed, Full Digit exceeding the threshold, overflow error)

5. REAL --- Single-precision floating point type, not commonly used

6. DOUBLE ---- DOUBLE-precision floating point type, not commonly used

Ii. Balanced type

Char (n) ---- A fixed-length string with a length range of 1 ~ 254, commonly used

Varchar (n) ---- variable-length string; length range: 1 ~ 32672, commonly used

CLOB ----- character string of a large object. It is very large and never used. You need to study it again.

Iii. Time Type

Date ---- 4 bytes inserted in the format of 'yyyy-MM-DD'

Time ---- the insertion format of the three bytes is 'hh: MM: ss'

Timestamp ---- occupies 10 bytes of insert format 'yyyy-MM-DD HH: MM: ss'

Of course, this is all compressed in internal format.

Iv. Null Value

NULL indicates that NULL represents a NULL value of any data type. However, NULL cannot be used in any arithmetic or logical operation. If it is barely obtained, it is NULL.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.