Oracle 5.0 Reference Manual page 857

Table of Contents

Advertisement

Floating-point and fixed-point types also can be UNSIGNED. As with integer types, this attribute
prevents negative values from being stored in the column. Unlike the integer types, the upper range of
column values remains the same.
If you specify
the column.
Integer or floating-point data types can have the additional attribute AUTO_INCREMENT. When you
insert a value of
is set to the next sequence value. Typically this is value+1, where
column currently in the table.
11.1.4.6. Out-of-Range and Overflow Handling
When MySQL stores a value in a numeric column that is outside the permissible range of the column
data type, the result depends on the SQL mode in effect at the time:
• If strict SQL mode is enabled, MySQL rejects the out-of-range value with an error, and the insert
fails, in accordance with the SQL standard.
• If no restrictive modes are enabled, MySQL clips the value to the appropriate endpoint of the range
and stores the resulting value instead.
When an out-of-range value is assigned to an integer column, MySQL stores the value representing
the corresponding endpoint of the column data type range. If you store 256 into a
TINYINT UNSIGNED
When a floating-point or fixed-point column is assigned a value that exceeds the range implied by the
specified (or default) precision and scale, MySQL stores the value representing the corresponding
endpoint of that range.
Column-assignment conversions that occur due to clipping when MySQL is not operating in strict mode
are reported as warnings for
statements. In strict mode, these statements fail, and some or all the values will not be inserted or
changed, depending on whether the table is a transactional table and other factors. For details, see
Section 5.1.7, "Server SQL
In MySQL 5.0, overflow handling during numeric expression evaluation depends on the types of the
operands:
• Integer overflow results in silent wraparound.
DECIMAL
• Floating-point overflow produces a
INF, or NaN.
For example, the largest signed
wraps around to the minimum
mysql>
SELECT 9223372036854775807 + 1;
+-------------------------+
| 9223372036854775807 + 1 |
+-------------------------+
|
-9223372036854775808 |
+-------------------------+
To enable the operation to succeed in this case, convert the value to unsigned;
mysql>
SELECT CAST(9223372036854775807 AS UNSIGNED) + 1;
+-------------------------------------------+
| CAST(9223372036854775807 AS UNSIGNED) + 1 |
+-------------------------------------------+
|
for a numeric column, MySQL automatically adds the
ZEROFILL
(recommended) or
NULL
AUTO_INCREMENT
column, MySQL stores 127 or 255, respectively.
ALTER
Modes".
overflow results in a truncated result and a warning.
BIGINT
BIGINT
9223372036854775808 |
Numeric Types
into an indexed
0
AUTO_INCREMENT
sequences begin with 1.
INFILE, UPDATE, and multiple-row
TABLE,
LOAD DATA
result. Overflow for some operations can result in +INF,
NULL
value is 9223372036854775807, so the following expression
value:
837
UNSIGNED
column, the column
is the largest value for the
value
TINYINT
attribute to
or
INSERT
-

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents