Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    3

    Unanswered: Problem with select returning 0 rows in an IN clause

    Hi,

    I have the following prepared statement:

    UPDATE AAA_TABLE SET BBB_FIELD = ? WHERE CCC_FIELD IN (SELECT DISTINCT CCC_FIELD FROM AAA_TABLE WHERE DDD_FIELD IS NULL FETCH FIRST ? ROWS ONLY)

    My problem is that the select sometimes returns 0 rows, which causes an error. Is this how DB2 works and is there a way around that problem?

    My environment:
    Windows 2000 SP3
    WebSphere AS v4.0.4
    Java 1.3.1
    DB2 v7 (don't know patches etc.)
    DB2 JDBC (don't know any version details)

    I'm sorry I can't specify the versions in more details. If the problem could be due to a specific version, I could look into this.

    Thanks in advance!
    Last edited by afloom; 10-02-03 at 06:20.

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

    I am not 100% sure, but if I remember right update with fetch first x rows only can be done only with db2 version 8.

    Hope this helps,
    Grofaty

  3. #3
    Join Date
    Oct 2003
    Posts
    3
    But the fetch first x rows is for the select. Could it still be a problem in v7?

  4. #4
    Join Date
    Oct 2003
    Posts
    3
    Originally posted by grofaty
    Hi,

    I am not 100% sure, but if I remember right update with fetch first x rows only can be done only with db2 version 8.

    Hope this helps,
    Grofaty
    Grofaty,

    I seems as you were absolutely correct. Removing the fetch first part it works! Lots of thanks!!!!

    Regards

Posting Permissions

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