Thai characters not allowing more than 1333 characters from Java code.is there any possible way except using CLOB data type in db. we are using Oracle 11g.
-
3You should post some example code ([Minimal, Complete, Verifiable Example](https://stackoverflow.com/help/mcve) or a [Short, Self-Contained, Correct Example](http://sscce.org/)). Include what you've already tried and where exactly you're stuck. See more info at [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) Thanks! – Will Dec 30 '15 at 12:06
-
code in jsp.. – mujafar Jan 04 '16 at 06:04
-
Update PR_OTHER_DETAIL set ESCORT_REMARKS=? where pat_id='123'; – mujafar Jan 04 '16 at 06:06
-
preparedstament.setString(1,remarks); in java file.. – mujafar Jan 04 '16 at 06:07
-
ESCORT_REMARKS varchar2(4000 char) declared in oracle 11g db – mujafar Jan 04 '16 at 06:10
-
its updating correctly in db upto 1333 thai characters properly if i pass from jsp text area. if thai characters more than 1333 characters error is coming. ERROR:: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column – mujafar Jan 04 '16 at 06:12
2 Answers
Simply, no (I assume you use VARCHAR2 data type.), except Oracle 12c with EXTENDED
string.
VARCHAR2
columns allow 4000 bytes in normal mode and up to 32767 in extended.
Thai requires multibyte characters that's why more than 1333 characters can take more than 4000 bytes.
NVARCHAR2
columns allow 2000 characters in normal mode and up to 16383 in extended.

- 5,669
- 1
- 19
- 29
-
i have done alter table tbname modify REMARKS nvarchar2(4000 ); if i pass 1500 thai characters still i am getting the same error. ERROR:: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column – mujafar Dec 30 '15 at 12:09
-
See the error - Oracle complaints about LONG binding so it's not related to VARCHAR limit. – Husqvik Dec 30 '15 at 12:16
-
but it is allowing upto 1333 thai characters.. if i crossed the limit it throwing the error ? please help... – mujafar Dec 30 '15 at 12:44
-
I didnt find out where the problem is.. if you know.. please guide me to come out from this issue... – mujafar Dec 31 '15 at 05:52
What is the db character set ?
I suspect your scenario is as follows:
- al32utf8 is the db character set.
- the varchar2 column(s) in your table(s) have byte semantics.
The utf8 encoding represents each thai in up to 3 bytes. thus you encounter the length limit of 1333 instead of 4000.
You can change the length semantics from byte to char with ALTER TABLE MODIFY <column> VARCHAR2(n CHAR);
(ref.: see here).
For the sake of completness: in case you are operating with a single byte db character set like WE8ISO8859P11
( iso 8859-11, thai script ), characters can be composed from base characters and diacritical marks. In that case you might have success in changing encoding in the data source to use the code points for composite characters. However, I feel this scenario is unlikely, given that actually each of your test data characters must be composed from three parts to match the observation.

- 17,010
- 4
- 35
- 61