string loses last (escaped) character in oracle db

T

tamer kavlak

hallo

I'm storing a string message into a varchar2(4000) column in oracle
db. the message is a concatination of multiple "small" strings with
"\u0001" as a delimiter. that delimiter is also the very last
character in the builded message, e.g.

"somertext" + "\u0001" + "somethingelse" + "\u0001" + ... + "\u0001"

when I read back the contetn from the db, the very last delimiter is
gone !

"somertext" + "\u0001" + "smethingelse" + "\u0001" + ...

can anybody give me a hint on that problem.

of course I can do a check and add the delimiter, but I would like to
understand the problem.

wI use pl/sql store procedure to pass in the values and also for
reading.

thx

tamer
 
C

Chris Smith

tamer said:
I'm storing a string message into a varchar2(4000) column in oracle
db. the message is a concatination of multiple "small" strings with
"\u0001" as a delimiter. that delimiter is also the very last
character in the builded message, e.g.

"somertext" + "\u0001" + "somethingelse" + "\u0001" + ... + "\u0001"

when I read back the contetn from the db, the very last delimiter is
gone !

Just a guess. If this is a CHAR column, then the driver may be trying
to strip excess whitespace surrounding the String. A control character
is often treated as whitespace (and in particular, if the driver uses
String.trim() to do this, then that will remove the trailing
whitespace). The fact that Oracle adds whitespace to the end of a CHAR
column is a fundamental limitation that you'll need to work around,
perhaps by adding a special character at the end, or using VARCHAR
instead.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
S

steve

hallo

I'm storing a string message into a varchar2(4000) column in oracle
db. the message is a concatination of multiple "small" strings with
"\u0001" as a delimiter. that delimiter is also the very last
character in the builded message, e.g.

"somertext" + "\u0001" + "somethingelse" + "\u0001" + ... + "\u0001"

when I read back the contetn from the db, the very last delimiter is
gone !

"somertext" + "\u0001" + "smethingelse" + "\u0001" + ...

can anybody give me a hint on that problem.

of course I can do a check and add the delimiter, but I would like to
understand the problem.

wI use pl/sql store procedure to pass in the values and also for
reading.

thx

tamer

give us the sql/ java you are using to do the actual storing of the string,
the above tells us nothing.


steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top