在开发的过程中遇到需要把一行数据显示成N行,当时马上就想到了connect by level 这个实在太好用了
显示一行
select level rn from dual connect by level < 2;
显示二行
select level rn from dual connect by level < 3;
实例:目前显示一行
select pha.segment1, pha.type_lookup_code, pha.authorization_status from po_headers_all pha where pha.po_header_id = 3085
结果:显示一行
修改后显示两行:
select pha.segment1, pha.type_lookup_code, pha.authorization_status from po_headers_all pha, (select level rn from dual connect by level < 3) where pha.po_header_id = 3085
结果:显示两行
执行计划也是相当优秀的:
标签:level,pha,connect,dual,Oracle,po,select From: https://www.cnblogs.com/ivenlin/p/18121299