Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: Get number of rows in result?

    Hello, all!
    I am writing a small application server for DB2(AS/400) on C/CLI.
    Is there any way to get a number of rows in result after select but before the whole circle of fetch operations?
    WBR, HabaHaba.

  2. #2
    Join Date
    May 2003
    If you mean the number of rows in a cursor, then I think you would have to submit two queries. First query (not in a cursor) that only selects count(*), but has same predicates. Second query would be the normal cursor that is fetched one row at a time.

    The reason is that DB2 does not always know the entire number of rows in the cursor until you fetch them (unless cursor materialization is necessary to return the first row). In some cases, depending on the isolation level, the answer set could change between the first fetch and the last fetch.

Posting Permissions

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