select *
from ( select a.*, rownum rnum
from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
where rownum <= MAX_ROWS ) where rnum >= MIN_ROWS
Wednesday, March 29, 2006
get the top n rowns from M rows of a Resultset
Posted by Vetriselvan at 3/29/2006 04:06:00 PM 0 comments
Tuesday, March 28, 2006
The smart way of coding
I had an requirement like
":,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,"
i have to replace the first : with 1 and the second : with 2 and it goes on.....
the solution for that was
select max(sys_connect_by_path(l,',')) from
(select level l
from dual
connect by level <= length(replace(':,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,',',')))
start with l=1
connect by l = prior l+1
could have done this way , it would have been better.
i was forced to type manually , LOL [reason : to make sure it is correct.]
it sucks, always.. use ur skills instead of manual service.
for that only we have been hired ;)
Posted by Vetriselvan at 3/28/2006 02:32:00 PM 1 comments