Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > How to set up record paging with a stored proc?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-04, 10:21
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
How to set up record paging with a stored proc?

Hi everyone...I've got an ASP page that has an oracle stored proc in it. The problem is im paging records and since I have to run the entire query in the SP even though I'm only viewing say 15 at a time. This is coming at a very large costs because of the sheer amount of total records (20k +??)
I've found this article:
http://www.15seconds.com/issue/010308.htm

On writing a stored proc to do record paging on SQL server....Can anyone give me an example or a link with further info on settnig up record paging with Oracle instead? This would get me out of a huge jam...

Thank you in advance
Reply With Quote
  #2 (permalink)  
Old 09-30-04, 12:15
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 4,874
Modify the procedure to take 2 extra IN parameters:
p_from in integer,
p_to in integer

These can then be used in the query like this:
Code:
select empno, ename, rn from ( select empno, ename, rownum rn from ( select empno, ename from emp order by empno ) where rownum <= p_to ) where rn >= p_from;
Then call it from your ASP page with p_from and p_to values like 1 and 15, 15 and 30, 31 and 45 etc.
__________________
Tony Andrews
http://tonyandrews.blogspot.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On