trim in Oracle is not working

Posted on 2011-10-10
Last Modified: 2012-05-12

I tried to trim the value from one field from table A;

select fieldA, dump(fieldA) from table A;

V004888,Typ=1 Len=11: 32,32,32,86,48,48,52,56,56,56,32

How can i retrieve fieldA without special character?

Question by:idmdeveloper
    LVL 73

    Expert Comment

    if fieldA is of type CHAR,  it will always be right-padded with spaces.

    however,  this should yield what you are looking for

    select trim(fielda) from tableA;
    LVL 73

    Expert Comment

    yes, I just tried it....

    ---- without trim

    SELECT fielda, DUMP(fielda) FROM tablea;
    FIELDA     DUMP(FIELDA)                               
    ---------- -------------------------------------------
       V04888  Typ=1 Len=10: 32,32,32,86,48,52,56,56,56,32
    1 row selected.

    Open in new window

    with trim

    SELECT trim(fielda), DUMP(trim(fielda))  FROM tablea;
    ------------ ------------------------------
    V04888       Typ=1 Len=6: 86,48,52,56,56,56
    1 row selected.

    Open in new window

    if these aren't your results, please post sample data and expected output.
    LVL 25

    Accepted Solution

    Anything else on this issue?

    Author Closing Comment

    Thanks a lot

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
    Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now