is this code correct

Posted on 2011-05-11
Last Modified: 2012-05-11
Is the below code right if so wht does it mean exactly when im running it in editor im getting error saying 'invalid sql statement'

TRIM (REPLACE (REPLACE (REPLACE (rec_pdr_email.message_to, CHR (10), ''), CHR (13), ''), CHR (9), ''))
Question by:thota198
    LVL 76

    Accepted Solution

    The 'syntax' is correct.  It replaces the ascii characters 10,13, and 9 (Line feed, Carriage return and tab) from the string.

    You can see it with:

    select TRIM (REPLACE (REPLACE (REPLACE ('He      llo', CHR (10), ''), CHR (13), ''), CHR (9), ''))
    from dual;
    LVL 76

    Expert Comment

    by:slightwv (䄆 Netminder)
    I might go with a regexp_replace:

    select trim(regexp_replace('He      llo', '['|| chr(10)||chr(13)||chr(9) || ']','')) from dual;

    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

    Suggested Solutions

    Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
    From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
    This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
    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

    729 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

    21 Experts available now in Live!

    Get 1:1 Help Now