Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    15

    Unanswered: One or more values in the INSERT statement, UPDATE statement, or foreign key update c

    I get this error when updating a database I am working with (DB2 V7).

    I loop through the contents of a file and based on a flag U = Update,
    N = Insert & D = Delete, I perform the action on the item with the
    table.

    The table is three rows in length: id, part_number, qty.

    I have a unique index on id, part_number, qty.

    If the flag = U then I try to update the row.
    If the update fails, I set the falg to N and try to insert the new
    row.

    If the flag = D then I delete the row.

    If the flag = N I try to insert the row.
    If that fails I catch the error and attempt an update.

    A Problem appears to occur when the flag = N to Insert. All inserts
    are failing with the [IBM][CLI Driver][DB2/SUN] SQL0803N error
    described in the subject.

    My problems with this are:

    1. If I catch the error then it would mean that the row already exists
    and I try the subsequent processing.
    2. The update then throws a non unique row error.
    3. When finished, none of the rows that errored are existing in the
    database so I am at a loss to figure out where the part went and why
    it errored!!!

    How can this be the case????

    Shannon
    Shannon Whitty
    reynolds.com.au

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: One or more values in the INSERT statement, UPDATE statement, or foreign key update c

    It is a bit strange ...

    But I would go back to check the table and unique index definitions ...

    Use the indexid and tablename referred in the SQL0803N error message and do
    SELECT INDNAME, INDSCHEMA,UNIQUERULE
    FROM SYSCAT.INDEXES
    WHERE IID = <index-id>
    AND TABSCHEMA = 'schema'
    AND TABNAME = 'table'


    If you have already done, I'm at loss of ideas ....

    Maybe, an eventmonitor will show more information ... Not sure though ..

    Cheers

    Sathyaram

Posting Permissions

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