跳到主要内容
跳到主要内容

NON_NULLABLE

non_nullable

description

提示

仅供开发者调试用,请勿在生产环境手动调用该函数。

Syntax

T non_nullable(T expr)

如果 expr 为非 nullable 类型,或为 nullable 类型且其中包含 NULL 值,则报错。否则返回该列的非 nullable 属性数据列。

example

mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1;
+------+------------------+
| k1 | non_nullable(k1) |
+------+------------------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
+------+------------------+

mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1;
ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]There's NULL value in column Nullable(Int32) which is illegal for non_nullable
mysql> select non_nullable(1);
ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]Try to use originally non-nullable column Int8 in nullable's non-nullable convertion.

keywords

non_nullable