Results 1 to 5 of 5

Thread: Error SQL0302N

  1. #1
    Join Date
    Feb 2004
    Posts
    30

    Unanswered: Error SQL0302N

    Hi everybody,

    I get the following error message as I try to import data from an ASCII delimited file wich contains UTF-8 characters (converted from Chinese characters with BIG-5):

    SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. SQLSTATE=22001

    However, I have checked the length of the importing data and found they do not exceed the corresponding field length. Does anyone get idea, hints or any experience for this problem, please help me.

    Thanks in advance.
    Athens.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: Error SQL0302N

    Originally posted by athensy
    Hi everybody,

    I get the following error message as I try to import data from an ASCII delimited file wich contains UTF-8 characters (converted from Chinese characters with BIG-5):

    SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. SQLSTATE=22001

    However, I have checked the length of the importing data and found they do not exceed the corresponding field length. Does anyone get idea, hints or any experience for this problem, please help me.

    Thanks in advance.
    Athens.
    Remember, some characters represented by UTF-8 take 2 or 3 bytes, whereas field length is specified in bytes, not characters. This means that a string consisting of 10 UTF-8 characters will not necessarily fit into a CHAR(10) field.

  3. #3
    Join Date
    Feb 2004
    Posts
    30
    Hi n_i,

    Thanks for your help. Do you mean that if I need to store a UTF-8 data of 10 characters, I should declare the corresponding field length to CHAR(20) or even CHAR(30)? Please tell me more.

    Thanks.
    Athens.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Originally posted by athensy
    Hi n_i,

    Thanks for your help. Do you mean that if I need to store a UTF-8 data of 10 characters, I should declare the corresponding field length to CHAR(20) or even CHAR(30)? Please tell me more.

    Thanks.
    Athens.
    Yes that's what I meant. I'd use VARCHAR though.

  5. #5
    Join Date
    Feb 2004
    Posts
    30
    Hi n_i,

    Thanks for your help. I find a way to overcome my problem today by adding a 'CODEPAGE=1208' parameter on my data importing command (preserve the import data in BIG-5 format). The error is gone and the conversion is OK. Anyway, you advise is very helpful for me to shoot this problem. Thanks again.

    Athens.

Posting Permissions

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