oracle - Ranking without an order by -
is there way create row_number "on fly" without ordering column? i've got query :
select regexp_substr(',a-b,b-c,c-d', '[^,]+', 1, level) legs dual connect regexp_substr(',a-b,b-c,c-d', '[^,]+', 1, level) not null
and need keep order of rotation, need rank sure rotation good. tried take near rank, dense_rank, row_number,... need order by, can't use.
it give this
rank | legs 1 | a-b 2 | b-c 3 | c-d
you can use level
, though need alias it:
select level rnk, regexp_substr(',a-b,b-c,c-d', '[^,]+', 1, level) legs dual connect regexp_substr(',a-b,b-c,c-d', '[^,]+', 1, level) not null; rnk legs ---------- ------------ 1 a-b 2 b-c 3 c-d
Comments
Post a Comment