Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

TechTip: SQL--Limit the Size of Your Result Set

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TechTip: SQL--Limit the Size of Your Result Set

    ** This thread discusses the article: TechTip: SQL--Limit the Size of Your Result Set **
    ** This thread discusses the Content article: TechTip: SQL--Limit the Size of Your Result Set **
    0

  • #2
    TechTip: SQL--Limit the Size of Your Result Set

    ** This thread discusses the article: TechTip: SQL--Limit the Size of Your Result Set **
    Thanks for the tip, but I'd like to know if there's a way with this method to A) get not just the first 10, but 11-20, 21-30, in order to "page" through a result set and B) retrieve the total number of records in a result set without reading each one. We are now reading the entire set each time, and using hidden fields to keep track of which records have their detail displayed so we can display paging links kind of like: Prev 10 11-20 shown Next 10 of 96 total Thanks in advance for any help.

    Comment


    • #3
      TechTip: SQL--Limit the Size of Your Result Set

      ** This thread discusses the article: TechTip: SQL--Limit the Size of Your Result Set **
      sgi400 wrote: > Thanks for the tip, but I'd like to know if there's a way with this > method to A) get not just the first 10, but 11-20, 21-30, in order to > "page" through a result set and B) retrieve the total number of > records in a result set without reading each one. We are now reading > the entire set each time, and using hidden fields to keep track of > which records have their detail displayed so we can display paging > links kind of like: Prev 10 11-20 shown Next 10 of 96 total I believe you would use the FETCH command. The following is from the V5R2 SQL Manual: EXEC SQL DECLARE C1 CURSOR FOR SELECT DEPTNO, DEPTNAME, MGRNO FROM TDEPT WHERE ADMRDEPT = 'A00'; EXEC SQL OPEN C1; while (SQLCODE==0) { EXEC SQL FETCH C1 INTO :dnum, :dname, :mnum; } EXEC SQL CLOSE C1; Bill

      Comment

      Working...
      X