Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008

    Unanswered: String in the UPDATE or INSERT statement is too long


    I get below mentioned error when I tried to execute an Update query against DB2 9.1 server:
    "SQL0404N A string in the UPDATE or INSERT statement is too long for column
    "". SQLSTATE=22001"

    Here is the definition of Table(RAC):

    ColumnName DataType
    --------- --------

    VALID Integer
    PARTID Integer

    Here is the query I have used to update the above table:

    UPDATE RAC SET STRVAL = 'String is of length 8,000 characters......' where VALID = 20

    I wonder eventhough the column of type LONG VARCHAR has capability to store 16k chararcters why did
    I get the above mentioned error.
    How to resolve this error?


  2. #2
    Join Date
    Jan 2007
    Jena, Germany
    Something in what you wrote doesn't line up: The limit for LONG VARCHAR is 32700 bytes - not 16K as you state.

    You are aware that LONG VARCHAR is deprecated and shouldn't be used any longer? I wouldn't be surprised if the error message is due to something not being supported for this type. You should switch to VARCHAR or CLOB instead.

    How do you execute the statement? Maybe your shell clobbers it? Or do you have an application that executes the statement dynamically? If the latter, have you considered parameter markers since they avoid hassles with escaping strings and SQL injection security problems.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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