SelectDB Enterprise
参考手册
SQL 函数
表值函数
NUMBERS

NUMBERS

描述

表函数,生成一张只含有一列的临时表,列名为number,如果指定了const_value,则所有元素值均为const_value,否则为[0,number) 递增。

语法

NUMBERS(
    "number" = "<number>"
    [, "<const_value>" = "<const_value>" ]
  );

必填参数

字段描述
number行数

选填参数

字段描述
const_value常量值

返回值

字段名类型描述
numberBIGINT指定每行返回的值

举例

select * from numbers("number" = "5");
+--------+
| number |
+--------+
|      0 |
|      1 |
|      2 |
|      3 |
|      4 |
+--------+
select * from numbers("number" = "5", "const_value" = "-123");
+--------+
| number |
+--------+
|   -123 |
|   -123 |
|   -123 |
|   -123 |
|   -123 |
+--------+
© 2025 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标