Results 1 to 5 of 5

Thread: -811 error

  1. #1
    Join Date
    Sep 2003
    Location
    manila
    Posts
    21

    Question Unanswered: -811 error

    In a COBOL program that executes a simple sql statement without using a cursor, does DB2 evaluates all the values return by the SQL before flagging the -811 error or Upon fetch of 1 and recognizing that another record was fetch right after that, it will flag the -811?

  2. #2
    Join Date
    Jan 2003
    Posts
    1,605
    Hi,

    Please read Must read before posting thread for more tips on how to write effective post.

    Hope this helps,
    Grofaty

  3. #3
    Join Date
    Sep 2003
    Location
    manila
    Posts
    21
    I'm using DB2 ver 7 for Z/OS.

    -811 THE RESULT OF AN EMBEDDED SELECT STATEMENT IS A TABLE OF MORE THAN ONE ROW, OR THE RESULT OF THE SUBQUERY OF A BASIC PREDICATE IS MORE THAN ONE ROW.

    Explanation: Execution of an embedded SELECT statement has resulted in a result table containing more than one row. Alternatively, a subquery contained in a basic predicate has produced more than one value.

    However I would like to know if DB2 stores or read the entire result of the sql before flagging -811 sqlcode

  4. #4
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    DB2 only checks, if there is a second row which qualifies. If this is the case, it will return a -811. To prevent DB2 from doing this, is to add the clause FETCH FIRST 1 ROW ONLY.

  5. #5
    Join Date
    Sep 2003
    Location
    manila
    Posts
    21
    thanks! =)

Posting Permissions

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