第一次遇到这么怪的有关问题.

第一次遇到这么怪的问题....tableA三个字段codestartendA15B47C1014........写个select语句得到如下结果co

第一次遇到这么怪的问题....
table   A   三个字段
code       start       end  
A               1               5
B               4               7
C               10             14
........
写个select   语句得到如下结果
code       number
A               1
A               2
A               3
A               4
A               5

B               4
B               5
B               6
B               7

C               10
C               11
C               12
C               13
C               14


[解决办法]
可以用游标实现
[解决办法]
try:


select
A.code,(A.start+B.id) as number
from
A,(select 0 as id union select 1 union select 2 union ... union select 10) B
where
A.start+B.id <=A.end
[解决办法]
可以生成一个连续序列的临时表,支持最大跨度1000或更大,然后联接源表和临时表。
[解决办法]
游标和临时表配合使用,这个问题很容易就解决了
[解决办法]
select a.code,b.n
from a,(select rownum n from all_objects) b
where b.n> =a.start and b.n <=a.end
[解决办法]
select a.code,b.n
from a,(select rownum n from all_objects) b
where b.n> =a.start and b.n <=a.end
-------------
厉害,膜拜一下
[解决办法]
如果end 的值大于> select count(*) from all_objects,上面的查询失败了