The storage format for the NUMBER data type in OceanBase AI Database is consistent, but it can be divided into the four formats listed in the following table based on its value range definition.
Storage type |
Default Syntax Storage Rules |
Description |
|---|---|---|
Fixed-point number DECIMAL(M,D) = {10^{-D}*i | i = 0,1,...,10^M-1} where M is a natural number and D is an integer. |
|
if and only if D1 <= D2 and M1-D1 <= M2-D2. The fixed-point number (M1,D1) is a subset of the fixed-point number (M2,D2). |
| Unsigned Fixed-Point Number DECIMAL(M,D) |
|
The equivalent fixed-point number without sign is a fixed-point number. DECIMAL(M,D) Non-negative numbers in the middle |
The conversion rules for all NUMBER types in OceanBase AI Database are shown in the following table. A "-" in the table indicates a case that spans compatibility modes.
Notice
A disallowed instant conversion requires data rewriting. Even if instant conversion is allowed, it does not guarantee that all source-type data can be losslessly inserted into the destination type. For example, converting a fixed-point number to an unsigned fixed-point number is not allowed.
Instant Conversion Allowed (From\To) |
Fixed-point number (M2,D2) |
Unsigned Fixed-Point Number (M2,D2) |
|---|---|---|
| Fixed-point number (M1, D1) | Conversion condition: D1 <= D2 and M1 - D1 <= M2 - D2 | Not supported |
| Unsigned Fixed-point Number (M1,D1) UNSIGNED | Conversion condition: D1 <= D2 and M1 - D1 <= M2 - D2 | Conversion condition: D1 <= D2 and M1 - D1 <= M2 - D2 |