string loses last (escaped) character in oracle db

Discussion in 'Java' started by tamer kavlak, Oct 14, 2004.

  1. tamer kavlak

    tamer kavlak Guest

    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
    tamer kavlak, Oct 14, 2004
    #1
    1. Advertising

  2. tamer kavlak

    Chris Smith Guest

    tamer kavlak wrote:
    > 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
    Chris Smith, Oct 14, 2004
    #2
    1. Advertising

  3. tamer kavlak

    steve Guest

    On Fri, 15 Oct 2004 00:51:47 +0800, tamer kavlak wrote
    (in article <>):

    > 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
    steve, Oct 18, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page