Results 1 to 12 of 12
  1. #1
    Join Date
    Feb 2010
    Posts
    24

    Unanswered: Sqlcode: -668, sqlstate: 57016, sqlerrmc: 7

    I did a 'ALTER TABLE ALTER COLUMN on table XXX. I changed one column from CHAR(30) to VARCHAR(2000) and added one CHAR(1) column.
    It was successful. But after the ALTER I got this error when access table XXX in a Java JDBC

    DB2 SQL error: SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7

    Have tried everything found googling but could not get rid of the error.

    The SQL used in Java is
    SELECT T01."SEQNO", T01."VALUE3", "DELIMIT" FROM "SCHEMA.XXX" T01 WHERE T01."SEQNO"=1 FOR UPDATE OF "VALUE3", "DELIMIT"


    Any ideas?

    Thanks!

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    User response for reason-code:7

    Reorganize the table using the REORG TABLE
    command (note that INPLACE REORG TABLE
    is not allowed for a table that is in the reorg
    pending state).

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by brucejin View Post
    Have tried everything found googling but could not get rid of the error.?
    Next time, try reading the official DB2 documentation. You can use the online InfoCenter (this link is for version 9.7) or download the PDF manual for DB2 Messages Vol 2.
    SQL0668N
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Feb 2010
    Posts
    24
    Thanks!
    REORG works (IBM - Summarization and Pruning Agent failure attempting to insert a null value into the ITCAM for SOA summarization tables.).
    DB2/NT is a little special. I did the same ALTER on DB2/AS400, Oracle, MS SQL server, MySQL prior to DB2/NT and they all went OK without special treatment.

  5. #5
    Join Date
    Jul 2011
    Posts
    3

    but how about if can run reorg command?

    I have the same problem after I've dropped a column (if I'd had known this)and I can't run the reorg command, I get this error message:
    DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=TABLE;REORG ;JOIN <joined_table>, DRIVER=3.53.70

    if I run a select on table I get other message:
    DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016, SQLERRMC=7;DB2UT015.EXP_RECORD

    Is it already running the reorg command? any ideas how can I verify it?


    thanks^1000...

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    SQLCODE -104 is a syntax error. What is the reorg command you are trying to do, and how are you trying to do it?

    Andy

  7. #7
    Join Date
    Jul 2011
    Posts
    3
    I've tried many forms, like
    reorg table EXP_RECORD;
    reorg table db2u7015.EXP_RECORD;

    and I am using DbVisualizer, can be that the problem? looks like the editor doesn't recognize command reorg, because it doesn't highlight the word as it does with works like table or select...

  8. #8
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    That is what I suspected. REORG is not SQL, it is a DB2 command and cannot be executed as if it was SQL. You can either use the CLP to use REORG or you can use: IBM DB2 9.5 Information Center for Linux, UNIX, and Windows if you must use SQL.

    Andy

  9. #9
    Join Date
    Jul 2011
    Posts
    3

    it worked

    and that worked just perfect! I really appreciate your advise!

  10. #10
    Join Date
    Dec 2011
    Posts
    1

    What can be helpful as well?

    I have a big amount of SQLs which have to be executed in a sequence. Your solution helped me in some cases, after the tables have been altered. BUT!!!! thera re a lot of situaitions, where the REORG statement doesn't help. I am trying to make the insert into tha table, get the 668 ErrorCode and the reorg doesn't make it work! Do you have guys any ideas why and how to solve it!

    How can I check in which "pending" state the table currently is. Do I probably make some kind of additionial commit or wait before the next statement....

    Thanks a lot in advance for your help!!!!!

  11. #11
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Quote Originally Posted by zenit View Post
    I have a big amount of SQLs which have to be executed in a sequence. Your solution helped me in some cases, after the tables have been altered. BUT!!!! thera re a lot of situaitions, where the REORG statement doesn't help. I am trying to make the insert into tha table, get the 668 ErrorCode and the reorg doesn't make it work! Do you have guys any ideas why and how to solve it!

    How can I check in which "pending" state the table currently is. Do I probably make some kind of additionial commit or wait before the next statement....

    Thanks a lot in advance for your help!!!!!
    You can get 668 for several reasons. You need to post the entire error you are getting.

    Andy

  12. #12
    Join Date
    Oct 2012
    Posts
    1

    Hi Every one, i am getting following error. could anyone help me

    DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016, SQLERRMC=7;KOUKIA.FI_CFG_ORG_B_ITEM, DRIVER=3.57.110 {prepstmnt 1823108266 SELECT t0.PK_EFFECTIVE_DATE, t0.PK_ID, t0.CHILD_DIR_TYPE, t0.CHILD_DIR_URN, t0.CONVERSION_DATE, t0.CURRENCY, t0.DIR_DESC, t0.DIR_OTHER, t0.DIR_TYPE, t0.DIR_URN, t0.EXCHANGE_GROUP, t0.EXCHANGE_RATE, t0.HIGH_VAL_AMOUNT, t0.HIGH_VAL_AMOUNT_SYS, t0.NUM_CHEQUE_DIGITS, t0.PAYMENT_METHOD, t0.SELECT_ALL_METH, t0.START_CHEQUE_NUM, t0.TERMINATED_DATE FROM KOUKIA.FI_CFG_ORG_B_ITEM t0 WHERE (t0.PK_ID = ? AND t0.TERMINATED_DATE IS NULL) optimize for 1 row [params=?]} [code=-668, state=57016]
    at org.apache.openjpa.kernel.QueryImpl.execute(QueryI mpl.java:857)
    at org.apache.openjpa.kernel.QueryImpl.execute(QueryI mpl.java:779)
    at org.apache.openjpa.kernel.DelegatingQuery.execute( DelegatingQuery.java:525)
    at org.apache.openjpa.persistence.QueryImpl.execute(Q ueryImpl.java:254)
    at org.apache.openjpa.persistence.QueryImpl.getSingle Result(QueryImpl.java:317)

Posting Permissions

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