Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    1,074

    Unanswered: varchar2 Entries right-padded w spaces

    We have a table with a varchar2(10) field, and some entries are right-padded with spaces. Could someone help clarify the varchar2 datatype for me? I thought that these excess spaces would only be retained if the datatype was char(10).

    Thanks,
    Chuck

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    No, they are retained if and only if you asked for them, e.g.
    Code:
    insert into t (c) values ('abc     ');
    ...whereas CHAR pads out to the full length every time.

    i.e. CHAR pads, VARCHAR2 does not trim.

  3. #3
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    Get rid of the extra spaces with
    update table set columnname = trim(columnname);

    Then FIX the offending INSERT statement

    Gregg

Posting Permissions

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