1
SELECT CAST("12" AS UNSIGNED);
2
SELECT CAST(12 AS UNSIGNED);
3
SELECT CAST(0 AS UNSIGNED);
4
SELECT CAST("0" AS UNSIGNED);
7
# Check rounding issues for CAST
8
SELECT CAST(0.0 AS UNSIGNED);
9
SELECT CAST(0.1 AS UNSIGNED);
10
SELECT CAST(0.4 AS UNSIGNED);
11
SELECT CAST(0.5 AS UNSIGNED);
12
SELECT CAST(0.9 AS UNSIGNED);
13
SELECT CAST(10.1 AS UNSIGNED);
16
SELECT CAST("18446744073709551615" AS UNSIGNED);
17
SELECT CAST(18446744073709551615 AS UNSIGNED);
19
--error ER_INVALID_CAST_TO_UNSIGNED
20
SELECT CAST(-1 AS UNSIGNED);
21
--error ER_INVALID_CAST_TO_UNSIGNED
22
SELECT CAST(-18446744073709551614 AS UNSIGNED);
23
--error ER_INVALID_CAST_TO_UNSIGNED
24
SELECT CAST(-18446744073709551615 AS UNSIGNED);
26
--error ER_INVALID_CAST_TO_UNSIGNED
27
SELECT CAST("-1" AS UNSIGNED);
28
--error ER_INVALID_CAST_TO_UNSIGNED
29
SELECT CAST("-18446744073709551614" AS UNSIGNED);
30
--error ER_INVALID_CAST_TO_UNSIGNED
31
SELECT CAST("-18446744073709551615" AS UNSIGNED);
33
--error ER_INVALID_CAST_TO_UNSIGNED
34
SELECT CAST(-1.1 AS UNSIGNED);
35
--error ER_INVALID_CAST_TO_UNSIGNED
36
SELECT CAST(-18446744073709551614.1 AS UNSIGNED);
37
--error ER_INVALID_CAST_TO_UNSIGNED
38
SELECT CAST(-18446744073709551615.1 AS UNSIGNED);
40
--error ER_INVALID_CAST_TO_UNSIGNED
41
SELECT CAST("-1.1" AS UNSIGNED);
42
--error ER_INVALID_CAST_TO_UNSIGNED
43
SELECT CAST("-18446744073709551614.1" AS UNSIGNED);
44
--error ER_INVALID_CAST_TO_UNSIGNED
45
SELECT CAST("-18446744073709551615.1" AS UNSIGNED);
47
--error ER_INVALID_CAST_TO_UNSIGNED
48
SELECT CAST("-18446744073709551615.1" AS UNSIGNED);
50
SELECT CAST(-(-1) AS UNSIGNED);