ORACLE SQL:获取两个数字之间的所有整数 [英] ORACLE SQL:Get all integers between two numbers

查看:134
本文介绍了ORACLE SQL:获取两个数字之间的所有整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Oracle中,有什么方法可以选择包含在两个数字之间的数字(整数);我不想创建PL/SQL过程或函数.

Is there any way to select the numbers (integers) that are included between two numbers with SQL in Oracle; I don't want to create PL/SQL procedure or function.

例如,我需要获取3到10之间的数字.结果将是值3、4、5、6、7、8、9、10.

For example I need to get the numbers between 3 and 10. The result will be the values 3,4,5,6,7,8,9,10.

Thx.

推荐答案

使用Oracle DUAL表的这一技巧也有效:

This trick with Oracle's DUAL table also works:

SQL> select n from
  2  ( select rownum n from dual connect by level <= 10)
  3  where n >= 3;

         N
----------
         3
         4
         5
         6
         7
         8
         9
        10

这篇关于ORACLE SQL:获取两个数字之间的所有整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆