NUMBERS
更新时间:2025-10-16
描述
表函数,生成一张只含有一列的临时表,列名为number,如果指定了const_value,则所有元素值均为const_value,否则为[0,number) 递增。
语法
SQL
1NUMBERS(
2 "number" = "<number>"
3 [, "<const_value>" = "<const_value>" ]
4 );
必填参数
| 字段 | 描述 |
|---|---|
| number | 行数 |
选填参数
| 字段 | 描述 |
|---|---|
| const_value | 常量值 |
返回值
| 字段名 | 类型 | 描述 |
|---|---|---|
| number | BIGINT | 指定每行返回的值 |
举例
SQL
1select * from numbers("number" = "5");
Text
1+--------+
2| number |
3+--------+
4| 0 |
5| 1 |
6| 2 |
7| 3 |
8| 4 |
9+--------+
SQL
1select * from numbers("number" = "5", "const_value" = "-123");
Text
1+--------+
2| number |
3+--------+
4| -123 |
5| -123 |
6| -123 |
7| -123 |
8| -123 |
9+--------+
