Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Location
    Bangalore, India
    Posts
    2

    Unanswered: DB2 table Browse (embedded)

    Hi,

    Recently, I was coding for a DB2 table browse program, say 5 rows per screen, but was not able to form a logic to load only 5 rows at a time in a cursor, that is, everytime for example, the program executes this SQL for a cursor while scrolling down:

    SELECT EMPNO,ENAME,EDEPT,ESAL FROM EMP WHERE EMPNO > ?

    '?' will replace the last EMPNO displayed in the 5th row of the screen.

    Can anyone tell me whether such a query which loads more of rows than required in a cursor (to my opinion) is efficient enough ? Is there a better query (considering all insertion or deletion that can take place in between parallely in the same table) ?

  2. #2
    Join Date
    Nov 2004
    Posts
    374

    scrolling

    if using select * from table where empno > xx order by
    it will get all rows > xx and srt these rows
    it happens at open cursor
    do : select * from table where empno> xx fetch first 5 rows only
    be carefull to use also isolation level cs (or ur if no harm)
    hope this will help
    Best Regards, Guy Przytula
    Best Regards, Guy Przytula
    DB2/ORA/SQL Services
    DB2 DBA & Advanced DBA Certified
    DB2 Dprop Certified
    http://users.skynet.be/przytula/dbss.html

  3. #3
    Join Date
    Dec 2004
    Location
    Bangalore, India
    Posts
    2

    DB2 Table browsing (embedded)

    Quote Originally Posted by przytula
    if using select * from table where empno > xx order by
    it will get all rows > xx and srt these rows
    it happens at open cursor
    do : select * from table where empno> xx fetch first 5 rows only
    be carefull to use also isolation level cs (or ur if no harm)
    hope this will help
    Best Regards, Guy Przytula
    Hi Guy,

    Thanks.
    But you have completed my query:

    "select empno,ename,edept,esal from emp where empno > ? order by empno"

    will fetch all the rows after '?', but what I want is the cursor should only contain next 5 records (since I am using 5 rows per screen), therefore, any time, cursor should contain only 5 or less records.

    Further, I still doubt whether this is required or not? Whether this will improve the performance?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •