Results 1 to 7 of 7
  1. #1
    Join Date
    May 2003
    Location
    china
    Posts
    3

    Unhappy Unanswered: can't delete sucessful

    HELLO
    i can't delete one record, and when i use delete this sql , the db2 just close connect. but very strangely is i can delete other record in this table, just can delete one record.
    pls help me.

    thanks!

    Nicky

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Can you tell us the table definition (including indexes, primary keys, and foreign keys), and also the SQL delete statement?

  3. #3
    Join Date
    May 2003
    Location
    china
    Posts
    3

    Unhappy

    CREATE TABLE "DBA"."CHARGE_PUBLIC"
    ("CHARGE_CODE" DECimal(18,0) NOT NULL,
    "USER_CODE" VARCHAR(10) ,
    "USER_NAME" VARCHAR(40) NOT NULL,
    "CHARGE_TYPE" VARCHAR(10) NOT NULL,
    "CHARGE_VOUCHER" DECimal(18,0) NOT NULL,
    "CHARGE_DATE" DATE NOT NULL,
    "LATE_DATE" DATE NOT NULL,
    "PREPARED_MAN" VARCHAR(10) NOT NULL,
    "PREPARED_DATE" DATE NOT NULL,
    "CHECKED_MAN" VARCHAR(10) ,
    "CHECKED_DATE" DATE ,
    "RETRIEVE" VARCHAR(128) ,
    "OPERATION_SERIAL" DECimal(18,0) ,
    "PAY_TYPE" VARCHAR(2) NOT NULL,
    "MEMORY" VARCHAR(100) ,
    "FP_MAN" VARCHAR(10) ,
    "FP_DATE" DATE
    , PRIMARY KEY ("CHARGE_CODE")
    , CONSTRAINT "CHARGE_TYPE" FOREIGN KEY ("CHARGE_TYPE"
    ) REFERENCES "DBA"."CHARGE_TYPE"
    ON DELETE RESTRICT
    ) ;

    and i use the sql is
    delete from charge_public where charge_code=xx;

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    One possible explanation is that, since you have referential integrity, there are dependent rows on other tables (with delete restrict on their foreign keys) that prevent certain deletions from occurring on this table.

    Did you check the db2diag.log file for any error messages?

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

    As Marcus_A suggested try looking for table witch one is referencing to table you are trying to delete from (charge_public).

    Hope this helps,
    Grofaty

  6. #6
    Join Date
    May 2003
    Location
    china
    Posts
    3
    Marcus_A & grofaty

    thanks for your opinion.
    now i know the table has some problem. when i copy to another table, the system clue to "the index has some problem".
    so i don't know how to do it???i must creat the new table now ??can suggest me other way to solve this prolbem..

    thanks!

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

    Drop index. If this is the unique index generated with primary key. Then drop primary key and recreate it.

    Hope this helps,
    Grofaty

Posting Permissions

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