Trying to create a “List of Values ” including a table value and numbers below it

北战南征 提交于 2019-12-02 08:32:31

This should do it. Make sure that where I've put /* xxx */ you include a where clause that comes up with only 1 record. Most likely, you will use the ID of the Device table here.

SELECT     ROWNUM display_value
,          ROWNUM return_value
FROM       DUAL
CONNECT BY ROWNUM <= (SELECT Quantity FROM Device WHERE /* xxx */)
ORDER BY   ROWNUM DESC;

You don't need loops for this.

select level
from dual
connect by level <= 4
order by level desc;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!