Results 1 to 3 of 3

Thread: Result Sets

  1. #1
    Join Date
    Nov 2002
    Location
    Rio de Janeiro - Brazil
    Posts
    78

    Unanswered: Result Sets

    Greets,

    Im running DB2 V7.2 over AIX V4.3.3

    Im writting a small program in C, using Embedded SQL, to perform a balance line for few of our tables and now Im facing some problems.

    Id like to know if theres a way to store the result set from a Select in a structure or a vector.
    For Example:

    If I perform the following Select:

    EXEC SQL SELECT c1 INTO :v1 FROM t1 WHERE condition-clause;

    but the condition-clause wont return me only 1 row, but a small subset of the table.

    it returns me an error, on the SQLCA structure, telling me that the select returns more than one row.

    Ive seen examples using a Cursor to fetch the lines and then work with them, but for what I need, performance is crucial. That is, I need to get all the lines and after that, work with them.

    Have any of you seen or written anything similar?

    TIA

    Fernando Ohana.

  2. #2
    Join Date
    May 2003
    Location
    Amsterdam
    Posts
    65
    Performance with declaring a cursor, opening it and fetching rows is usually very good. If you write your code in a compiled language like C, there isn't anything that will perform better, except perhaps using stored procedures where you collect all info and return it to the client.
    Anton Versteeg
    IBM Netherlands

  3. #3
    Join Date
    Nov 2002
    Location
    Rio de Janeiro - Brazil
    Posts
    78
    Thanks Anton,
    But I was trying to find out another way to get this done, although, from what I read on their manuals, the only way to handle multiple rows on programs is using a Cursor.

    thanks anyway =)

    Fernando.

    Originally posted by antonv
    Performance with declaring a cursor, opening it and fetching rows is usually very good. If you write your code in a compiled language like C, there isn't anything that will perform better, except perhaps using stored procedures where you collect all info and return it to the client.

Posting Permissions

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