If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error SQL0302N

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-12-04, 05:37
athensy athensy is offline
Registered User
 
Join Date: Feb 2004
Posts: 29
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.
Reply With Quote
  #2 (permalink)  
Old 02-12-04, 09:54
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: Error SQL0302N

Quote:
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.
Reply With Quote
  #3 (permalink)  
Old 02-12-04, 20:39
athensy athensy is offline
Registered User
 
Join Date: Feb 2004
Posts: 29
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.
Reply With Quote
  #4 (permalink)  
Old 02-13-04, 10:29
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
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.
Reply With Quote
  #5 (permalink)  
Old 02-13-04, 22:12
athensy athensy is offline
Registered User
 
Join Date: Feb 2004
Posts: 29
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On