Remove carriage returns from a field in an oracle table

I have a field that is defined as a LONG in my oracle table; the data contained in this field has carriage returns/line feeds (it's free form text); as i'm selecting data from this field, i need the carriage returns removed so that the data from this field all appears on one line.
I tried using the TRANSLATE function to convert the carriage returns to something else, but that doesn't work.
Example:
Select comment from Notes:
COMMENT
the applicant called for an appointment;
an exam was scheduled for 4/1/05 at 9am;
called applicant to confirm app
this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled for 4/1/05 at 9am; called applicant to confirm app"
How can i do this? Can the decode function be used to remove the carriage returns in this field?

when i used translate its giving correctly,
SQL> ed
Wrote file afiedt.buf
1 select translate('the applicant called for an appointment;
2 an exam was scheduled for 4/1/05 at 9am;
3 called applicant to confirm app
4 this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled
5 How can i do this? Can the decode function be used to remove the carriage returns in this field
6* ',' ') from dual
SQL> /
TRANSLATE('THEAPPLICANTCALLEDFORANAPPOINTMENT;ANEXAMWASSCHEDULEDFOR4/1/05AT9AM;CALLEDAPPLICANTTOCONF
the applicant called for an appointment; an exam was scheduled for 4/1/05 at 9am; called applicant t
SQL> ed
Wrote file afiedt.buf
1 select 'the applicant called for an appointment;
2 an exam was scheduled for 4/1/05 at 9am;
3 called applicant to confirm app
4 this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled
5* How can i do this? Can the decode function be used to remove the carriage returns in this field
SQL> /
'THEAPPLICANTCALLEDFORANAPPOINTMENT;ANEXAMWASSCHEDULEDFOR4/1/05AT9AM;CALLEDAPPLICANTTOCONFIRMAPPTHIS
the applicant called for an appointment;
an exam was scheduled for 4/1/05 at 9am;
called applicant to confirm app
this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled for 4
How can i do this? Can the decode function be used to remove the carriage returns in this field?
SQL>

Similar Messages

  • How to remove carraige return from the field while loading external table

    I am facing an issue of not getting rid of carraige returns present in the fileds of the source .csv file while loading the records into external table.
    I had tried using LRTRIM, but it does not help.
    The error I am getting is:
    KUP-04021: field formatting error for field POPULATION_DESCRIPTION
    KUP-04037: terminator not found
    I am pasting one record out of the .csv file which is causing this error as below:
    "Business Card Accounts
    ",123,7 BizCard - Gamers,Control,"Business Card Accounts
    ",75270,75271
    You can see the carraige return in the 1st field as well as 5th field. Filed are separated by commas & eclosed by double quotes.
    Could anybody help on this please?

    Can you copy the file to an external table only version, and then dos2unix it?
    Alternatively, you can use the ACCESS PARAMETERS area in your external table definition to set that your RECORDS DELIMITED BY carriage returns, instead of the default.
    Check out the example here http://www.psoug.org/reference/externaltab.html

  • Remove Carriage Return from a TextEdit field

    Hi All,
    I have a tableview, of which the last field Description, is of type TextEdit. Not only this, when the data was migrated from a legacy system to SAP, either the last field with the value (If Description has value, Description field, else the field before Description) has 2 '##' at the end of it.
    The 2nd # is EQ to
    cl_abap_char_utilities=>newline
    , which I can remove using
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>newline IN <fs> WITH ''.
    But the first # is having the Hex Value 0D00, which is EQ to Carriage Return. CR_LF is Carraige Return and Line Feed, but here, I need to remove only CR.
    Can anyone give me the right solution?
    I tried moving this data to a string field and then do a REPLACE All... IN BYTE MODE, but again, it didn't work.
    Thanks and Regards
    Gladson Jacob

    Hi Patrick,
    The program's ending with a Short Dump. The code snippet is as below.
    DATA: it_contract TYPE TABLE OF zbpa_bp_contract,
          xstring_val TYPE x VALUE '0D00',
          value2 TYPE x VALUE '2000',
          string_value TYPE string,
          xstring_value TYPE xstring,
          stringtable TYPE TABLE OF string,
          reply_value TYPE TABLE OF tline.
    FIELD-SYMBOLS <fs> TYPE zbpa_bp_contract.
    SELECT * FROM zbpa_bp_contract
      INTO TABLE it_contract.
    *  WHERE id BETWEEN 2316 AND 2328.
    LOOP AT it_contract ASSIGNING <fs>.
      string_value = <fs>.
      APPEND string_value TO stringtable.
      CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
        TABLES
          text_stream = stringtable
          itf_text    = reply_value.
    ENDLOOP.
    The dump description is as follows
    Error analysis
        At the statment "DESCRIBE" only character-type data objects are supported at the argument position "TEXT_STREAM", but no strings are supported (data types STRING and XSTRING).
        In this particular case, the operand "TEXT_STREAM" has the type "g".
    <b>Please help.</b>
    Thanks in advance.
    Gladson
    Message was edited by:
            Gladson Jacob
    Message was edited by:
            Gladson Jacob

  • Remove Carriage return from string

    I have a free text area on a BSP (a form). When users type continuously in this area the text gets wraped. When the BSP is submitted it generates a sapscript form and the text area is printed on the form, but it has '##' which are placed where the text wrapped round. I would like to remove '##', so tried the following:
    replace all occurrences of '##' in text_area with ' '.
    This did not work as the '##' are not recognised presumably because they are some type of carriage return and not in fact has marks.

    If you dont have access to the class CL_ABAP_CHAR_UTILITIES, do this instead:
    DATA: crlf(2)   TYPE x VALUE '0D0A',
          itab      TYPE TABLE OF string,
          w_input   TYPE string.
       w_input = '<contains the text with the line feed.>'.
       SPLIT w_input AT crlf INTO TABLE itab.
    Regards Michael.

  • Removing Carriage Returns within a Textarea

    Hi,
    Just wondering if someone could please let me know how to remove carriage returns from a Textarea after submitting the page?
    Within my PL/SQL process, I have used both REPLACE and TRANSLATE on both CHR(10) and CHR(13) but unfortunately it stills comes out the other end as follows:
    Description :this
    is
    a
    testWould like it all on one line minus the carriage returns.
    Thanks.
    Tony.

    The code I showed works for me. Computations and processes work similarly except that in a process you have to save the value in session state whereas in a computation that's done for you. Show your code or put an example on apex.oracle.com if you can't get it to work and I'll check it.
    Scott

  • Reports not retaining carriage returns from htmldb_item.textarea

    I’m created a tabular form for multi row updates using htmldb_item.textarea for one of the fields. When I update the tabular form it keeps any carriage returns in this field, which is good. I then created a “PL/SQL function body returning a SQL Query” report for printing purposes. The problem is that the field populated by the htmldb_item.textarea does not retain any of the carriage returns in the report.
    I enter the following in the textarea on the tabular form:
    Line 1
    Line 2
    Line 3
    The report I created then displays the data as:
    Line 1 Line 2 Line 3
    I need the report to display the data the same as it appears on the tabular form.
    I tried this in my report from reading other similar situations on this forums, but didn’t work.
    replace("TEXTAREA",''||chr(13)||'',''||
    ||'') as title
    Anyone know of a solution?

    How about this?
    Go the page where you can edit the report column attribute - here is the bread crumb to help you figure out what I am talking about
    Home>Application Builder>Application 99999>Page Definition>Report Attributes>Column Attributes
    The second box in this page is Column formatting, you will find 4 text boxes (Number / Date Format, CSS Class, CSS Style, Highlight words) and a text area (HTML Expression). In the text area replace #COLUMN_ALIAS# with <PRE>#COLUMN_ALIAS</PRE>. You will get your newlines without tweaking the query or removing Strip HTML. Strip HTML is a security feature that I would not disable. On the down side you will loose some of the ability to format like fonts etc (:-(,
    Here is why you loose the newlines in the report. When browsers render html they have the liberty to reformat it. When reformating they can play around with whitespaces including new lines. To force a new line you have to use the BR tag or you can say the text is preformated using the PRE tags.

  • Address Book Adds Carriage Return to Street Field on Import

    I've been having some fun and games trying to import a large list of addresses in a tab delimited file into the Address Book. After finally managing to sort out all the issues with importing the file, I have now discovered that the value for the Street in all of the imported addresses has a carriage return (\r) character appended to them. There was not a carriage return present in the tab delimited file.
    I doublechecked the Address Book entries using Applescript to inspect the final character of the Street field and it was indeed a carriage return.
    I presume that this is due to the mapping of fields in the Address Book to the columns in my file. The Address Book allows you to enter 2 values for the Street, yet I am only using the first one with the second one being set to be ignored.
    However, the import still adds the carriage return character despite the second Street field not being required. It's not obvious that this is happening when viewing entries in the Address Book, yet when it comes to printing the imported addresses onto labels, a blank line is left due to the empty second Street field.
    If I edit the card and amend the Street field to, say, add a comma to the end of the Street or, take it away, the problem disappears. I don't want to manually edit all the imported address of which I have 275. Is there a workaround for this, or some Applescript that will automatically edit all the Street entries to remove the carriage return?
    Is anyone else experiencing this? Could this be classified as a bug?
    Before someone suggests I use the thirdparty Address Book Importer, I have tried that too and it also results in the same problem.
    Stuart
    Mac mini   Mac OS X (10.4.6)  

    The blank line appears when looking at the addresses through applications like SOHO Labels and Envelopes or Imprint. The problem is that the carriage return is added by the Address Book as it is being imported, rather than the carriage return being there already, so loading the tab delimited file into a spreadsheet will not show any carriage return characters.
    In the end I cooked up some Applescript to go through the Address Book and strip out any trailing carriage returns from the Street field for all addresses. I'm no Applescript guru, but the following seemed to do the trick:
    tell application "Address Book"
    set thePeople to every person
    repeat with thePerson in thePeople
    set theAddresses to every address of thePerson
    repeat with theAddress in theAddresses
    set streetinfo to street of theAddress
    if streetinfo ends with "\r" then
    set streetinfo2 to (text of characters 1 thru -2 of (streetinfo as string) as string)
    set street of theAddress to streetinfo2
    end if
    end repeat
    end repeat
    save addressbook
    end tell
    The other alternative was to write a script to parse my file in something like Ruby and then use Applescript to add the records rather than use the Address Book import feature. That would probably have given me some flexibility with being able to add multi-line notes, but the above was quicker to hack together.
    Stuart
    Mac mini (PPC)   Mac OS X (10.4.6)  

  • How can I remove ASCII text from a field when I use it in a query

    How can I remove ASCII text from a field when I use it in a query?
    I am running a select statement on a table that appears to have ASCII text in some of the fields. If I use these fields in the where statement like the code below nothing returns:
    SELECT FIELD1 FROM TABLE1 WHERE FIELD1 IS NULL
    But the field looks empty if I do a straight select without the where clause. Additionally, one of the fields has text but appears to be padded out with ASCII text, which I need to strip out before I can use this field in a where or join statement. I have tried using a trim, ltrim, rtrim, to_char, nvl, decode and nothing works. When I use excel to run the same query it looks as if these ASCII fields are boxes.
    I have asked our DBA team to see what they can do to prevent these from going into the table, but in the mean time I still need to run this report.
    Do you have any suggestions?

    Can you provide an example? I've been trying (for
    example) "select translate(' test one', ascii(' '),
    'X') from dual" with no luck.
    Thank you.To replace space, you should query like this:
    select translate(' test one', chr(32), 'X') from dual instead of select translate(' test one', ascii(' '), 'X') from dual Thanks,
    Dharmesh Patel

  • Remove carriage return between text two objects

    How to remove carriage return between objects. 
    I have a text box and table  I want to remove carriage return between them. 
    Also I have a table with two columns and I want to remove carriage return between these two columns.
    Thank You in advance.

    Hi ,
    Try like this ,
    --To replace Carriage return
    =REPLACE(Fields!Column.Value, CHAR(10), "" )
    --To replace Line feed
    =REPLACE(Fields!Column.Value, CHAR(13), "" )
    --To replace Tab
    =REPLACE(Fields!Column.Value, CHAR(9), "" )
    And also , ConsumeContainerWhitespace property to remove blank space -
    http://beyondrelational.com/modules/2/blogs/115/posts/11153/consumecontainerwhitespace-property-to-remove-blank-space-in-ssrs-2008-report.aspx
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • Need to remove carriage returns, spaces, etc.

    Hello,
    I am trying to build a string that is on one line,
    1,2,3,4,5,6,7,8,9
    however, I wind up with each number on a separate line.
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9
    My code looks like this:
    var xxx = "";
    for (var i=1; i<= nNumWords; i++) {
          global.srchVals[i].name = "Payor Mix";
       global.srchVals[i].mode = 0;
       xxx = i;
       if (i < nNumWords) {
       xxx = xxx + ",";
      //xxx = xxx.replace(/\s+/g,"").trim();
      } else {
       xxx = xxx;
       //xxx = xxx.replace(/\s+/g,"").trim();
          var PMItms = [xxx];
       //console.println(xxx);
    I tried using the following line of code to remove carriage returns and spaces:
       xxx = xxx.replace(/\s+/g,"").trim();
    But it keeps on giving me the following error:
    TypeError: xxx.replace(/\s+/g, "").trim is not a function
    Any help is appreciated.
    Thanks
    Linda

    I just want to make sure I'm approaching this problem the correct way.
    I am trying to build a string that is on one line,
    1,2,3,4,5,6,7,8,9
    however, in the debugging console, I wind up with each number on a separate line.
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9
    Will "Trimming" the string correct the issue?
    Thanks
    Linda

  • Carriage Returns in Textarea field in APEX Mail

    Greetings all,
    I have a form that the users fill out and when they click submit it uses APEX Mail to send the contents to individuals in an HTML format. One of the fields is a text area where the individual will enter information like the sample below:
    First to Arrive:  Bob
    Second to Arrive: Jane
    Third to Arrive: Sandy
    Last to Arrive: FredWhen the email is received, instead of being on one line, each entry follows the next like:
    First to Arrive: Bob Second to Arrive: Jane Third to Arrive: Sandy Last to Arrive: Fred
    I posted about getting the form fields to show the carriage returns and that works fine. Now trying to figure out what to add to make sure that line breaks are handles as html breaks br tags. Any assistance and examples would be appreciated.
    Thanks
    Wally
    Edited by: wfsteadman on Feb 17, 2011 4:49 PM

    3.  Re: Carriage Returns in Textarea field in APEX Mail
           617301
    this code looks like it should work but doesnt,
    REPLACE(REPLACE(REPLACE(:TEXT_FIELD_ITEM,CHR(10)||CHR(13),'&lt;br/&gt;'),CHR(10),'&lt;br/&gt;'),CHR(13),'&lt;br/&gt;')
    ....thanks.

  • How  to remove the check from ShpmntCostsRel. (field VTTK-    FRKRL)

    Hi Experts,
    Can you please tell me to how  to remove the check from ShpmntCostsRel. (field VTTK-    FRKRL) when saving of the shipment document.

    shipment cost calculation only on the Leg level and not on header level. Currently a lot of confusion happened after creating the shipment cost document and found that the status is u201CBu201D.
    now we intend to define detailed specifications to how to create this new user exit to update the shipment cost relevancy at shipment header.
    The main functionality of the user exit  to be created is to remove the check from ShpmntCostsRel. (field VTTK-    FRKRL).can u pls tell how to do this.

  • CONVERSION EXIT to remove thousand separator from quantity field

    HI
    NEED HELP
    do u know any  FM or CONVERSION EXIT which remove thousand separator from quantity field.
    Eg. 1,234,567.11 SHOULD be displayed as 1234567.11

    Hi Chetanpatil.
    Try this:
    If your quantity has thousand separator as comma:
    translate lv_quantity using ', '.
    condense lv_quantity.
    If your quantity has thousand separation as dot:
    translate lv_quantity using '. '.
    translate lv_quantity using ',.'.
    condense lv_quantity.
    You'll need to check for the user thousand separator configuration in table USR01 field DCPFM or by calling BAPI_USER_GET_DETAIL and act accordingly.
    Regards,
    Andres.

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • First occurence of a value from a  field in the internal table.

    How to select the first occurence of a value from a field in an internal table ?
    I don think , we can use select query .
    Any suggestions?
    provide syntaxs also .

    Hi...
    You have to use this code.
    DATA : Begin of IT_MARA occurs 0,
                 mtart type mara-mtart,
                 matnr type mara-matnr,
                 meins type mara-meins,
              END OF IT_MARA.
    START-of-SELECTION.
      SELECT MTART MATNR MEINS FROM MARA INTO TABLE IT_MARA.
    END-OF-SELECTION.
    LOOP AT  IT_MARA.
    <b>  AT NEW MTART.      "This will trigger for every first/new value of the field
                 <<<<WRITE YOUR CODE here>>
       ENDAT.</b>
    ENDLOOP.
    You can also use.
    LOOP AT  IT_MARA.
    <b> <b>  ON CHANGE OF IT_MARA-TART.   
                 <<<<WRITE YOUR CODE here>>
       ENDON.</b></b>
    ENDLOOP.
    <b>Reward if Helpful.</b>

Maybe you are looking for