Carriage Return/Linefeed Character Removal  for a CLOB variable

Hi,
Can anyone let me know how I can remove the carriage return from a CLOB variable.
I tried the replace function
REPLACE(D_MessageText, CHR(10)), it doesn't give any error,but the output still has the new line character.
Any help would be really appreciated.
Regards,
Anil.

chr(10) takes care of LINEFEED
chr(13) takes care of CARRIAGE RETURN

Similar Messages

  • Carriage Return/Linefeed Character Removal

    I'd like to remove CarriageReturn/Linefeed characters from varchar2 field data whenever I query that field. I was thinking of using the TRANSLATE function to do it, but I cannot figure out how to make SQL recognize that character. I've copied and pasted it from a SQL Plus query, but when I drop that character into my SQL code to TRANSLATE, SQL Plus jumps to the next line. I've tried enclosing that character in single quotes, but that did not work. Is there anyway to have the TRANSLATE function recognize this non-printing character, search for it, and replace it?

    SQL> insert into ttest values ('a','Hi'||chr(10)||'World');
    1 row created.
    SQL> select * from ttest where col1='a';
    COL COL2
    a Hi
    World
    SQL> select * from ttest where translate(col2,chr(10),' ') like 'Hi Wo%';
    COL COL2
    a Hi
    World

  • How to handle carriage return/linefeed embedded in text field as first char

    Hi,
    I am trying to use sqlldr to import text that is comma-separated and double quote-enclosed, but contains embedded carriage return/linefeed pairs. I have a control file which works for most cases and looks like this:
    LOAD DATA
    INFILE './foo.new'
    APPEND
    CONTINUEIF LAST PRESERVE (<>'"')
    INTO TABLE <tablename>
    FIELDS TERMINATED BY "," ENCLOSED BY '"'
    TRAILING NULLCOLS
    Unfortunately, this fails when the very first character of the text field is a carriage return/linefeed pair, e.g.,:
    "11","22","33","\r\nThis is the fourth field","","","","",""
    In that case, what is actually the opening double-quote for the fourth field, is interpreted by the CONTINUEIF clause as the end of that line. Can anyone please point me to a solution?
    thanks.
    stan.

    Thanks for the suggestion. Unfortunately, I've already tried it, and it doesn't help. I believe the problem is that sqlldr tries to figure out where each record is delimited before it parses out the field. So, any field-level trimming depends on sqlldr first determining that the cr/lf is actually part of that record, and not an indication of the start of a new record (and it's doing the latter right now). Fwiw, Python's csv parser will handle this type of record just fine.
    regards.
    stan.

  • Carriage return symbol is removed from XML

    Hello,
    It looks like SQL Server removes \r characters when parsing XML. So when my stored procedure receives values in xml for saving, all line breaks are represented as \n instead of \r\n.
    Is there any way I can force SQL Server not to remove \r characters? In the sample below Node1 value doesn't contain \r symbols.
    DECLARE @hDoc int
    DECLARE @Xml nvarchar(MAX)
    SET @Xml = N'<Root><Node1><![CDATA[' + nchar(13) + nchar(10) + N'Some ' + nchar(13) + nchar(10) + N' Value]]></Node1></Root>'
    EXEC sp_xml_preparedocument @hDoc OUTPUT, @Xml
    SELECT
    Node1
    ,convert(varbinary(max),Node1) -- Contains 0A00 in the start instead of 0D0A,
    ,charindex(nchar(13),Node1)
    FROM
    OPENXML(@hDoc, N'/Root', 2) WITH (Node1 NVARCHAR(MAX))
    EXEC sp_xml_removedocument @hDoc
    Thank you

    Hi dalong,
    The scenario you pointed is the behavior of the XML processor by default. If any characters with CARRIAGE RETURN (#xD), whenever CARRIAGE RETURN (#xD) is followed by LINE FEED (#xA) or not, will be translate to a single #xA character, to normalize all line
    breaks in external parsed entities on input before parsing.
    In this case, you may have a try to make use of REPLACE function in the SELECT statement to replace “nchar(10)” to “nchar(13)+nchar(10)”.
    Best Regards,
    Stephanie Lv
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Carriage Return in line Text for invoice line item.

    Hi,
    I am trying to create an non PO invoice through calling a BAPI "BAPI_INVOICE_CREATE"
    in which  i am passing all the required data . I have a field called "SGTXT" which is item text and i am passing this field
    which has maximum length of 50 char i just want to add a new line characters on to it. i.e want to support Carriage Return
    just want to know whether it can hold Carrige Return.
    I just tried by entering some Characters and hitting Enter the value which i am passing is simillar to
    itemtext
    "abcdabcdabcdabcd#
    abacdabcdabcd#
    abcdabcd"   My program is not able to parse this values hence landing into dump.
    How should i support this scenario.
    Thanks,

    Here is the dump.
    The termination occurred in the ABAP program "SAPLZIBA_SSP_READ_CSV" in
    "LINE_TO_CELL_ESC_SEP".                                                 
    The main program was "ZIBA_SSP_INVOICELOAD ".                                                                               
    The termination occurred in line 149 of the source code of the (Include) 
    program "LZIBA_SSP_READ_CSVF01"                                       
    of the source code of program "LZIBA_SSP_READ_CSVF01" (when calling the
    editor 1490).                                                           
            IF i_string CS l_pipe.                     
              l_stringlength = strlen( i_string ).     
              DO l_stringlength TIMES.                 
                REPLACE '  ' WITH '""' INTO i_string.  
                IF sy-subrc NE 0.                      
                  EXIT.                                
                ENDIF.                                 
              ENDDO.                                   
            ENDIF.                                     
            ASSIGN I_STRING(L_INT) TO <L_CELL>.        
            I_INTERN_VALUE = <L_CELL>.                 
          endif.                                       
          L_INT = L_INT + 2.                           
          I_SIC_INT = L_INT.                           
          I_STRING = I_STRING+L_INT.                   
        ELSEIF I_STRING CS C_ESC.                      
        letzte Celle                                 
          L_INT = SY-FDPOS.                            
          if l_int = 0.                                
            clear i_intern_value.                      
          else.                                        
            ASSIGN I_STRING(L_INT) TO <L_CELL>.        
            I_INTERN_VALUE = <L_CELL>.                 
          endif.                                       
          L_INT = L_INT + 1.                           
          I_SIC_INT = L_INT.                           
          I_STRING = I_STRING+L_INT.                   
          L_INT = STRLEN( I_STRING ).                  
          IF L_INT > 0 . MESSAGE X001(KX) . ENDIF.     
        ELSE.                                          
          MESSAGE X001(KX) . "was ist mit csv-Format   
        ENDIF.                                         
      ENDIF.                                           
    Can you let me knwo how should i put my condition to support CR .
    thanks,

  • Open a CURSOR for a CLOB variable in 9i

    Hi Friends,
    I have a procedure which has a CLOB variable,and a sys_refcursor as inputs.
    procedure proc1 ( p_sql clob, cur1 sys_refcursor);
    I need to open this cur1 for p_sql clob.
    OPEN CUR1 FOR P_SQL;
    But it gives an error. I went through webs and found that it is not possible to do it in 9i. Do u know any alternate ? How can I do it ?

    vishwa wrote:
    Hi Friends,
    I have a procedure which has a CLOB variable,and a sys_refcursor as inputs.
    procedure proc1 ( p_sql clob, cur1 sys_refcursor);
    I need to open this cur1 for p_sql clob.
    OPEN CUR1 FOR P_SQL;
    But it gives an error. I went through webs and found that it is not possible to do it in 9i. Do u know any alternate ? How can I do it ?Consider upgrading a an Oracle version that has been supported during the current Century.
    If you installed a newer version DB, it could be used to access the exist V9 DB;
    without any changes to the V9 DB itself.

  • ORA-21560: while size is less than 1 GB for a CLOB variable

    Hi ,
    I use "DBMS_XSLPROCESSOR.CLOB2FILE' to write data from a CLOB variable (Oracle 10g) to TXT file in unix. I assumed that
    the clob can collect data of around 4 gb , but it is throwing the "Out of Range" error if the size exceeds
    22502381 bytes, which is not at all sufficient to my requirement. I want to collect around 3GB in the variable.
    Is it possible ? Please help
    2008-12-22 11:08 Error Occurred
    ORA-21560: argument 2 is null, invalid, or out of range
    Declare
    Xfile CLOB ;
    v_buffer VARCHAR2(32767);
    v_eol VARCHAR2(2);
    v_eollen PLS_INTEGER;
    c_maxline CONSTANT PLS_INTEGER := 32767;
    v_lines PLS_INTEGER := 0;
    v_dir          VARCHAR2(1000) := 'XXX/YYY' ;
    v_data_string VARCHAR2(32767) ;
    x integer ;
    Begin
    v_eol := CASE
    WHEN DBMS_UTILITY.PORT_STRING LIKE 'IBMPC%'
    THEN CHR(13)||CHR(10)
    ELSE CHR(10)
    END;
    v_eollen := LENGTH(v_eol);
    DBMS_LOB.CREATETEMPORARY(Xfile, TRUE);
    FOR r in ( Select desc1||'~'||desc2||.....desc30 AS csv from desc_t )
    Loop
    IF LENGTH(v_buffer) + v_eollen + LENGTH(r.csv) <= c_maxline THEN
    v_buffer := v_buffer || v_eol || r.csv;
    ELSE
    IF v_buffer IS NOT NULL THEN
    DBMS_LOB.WRITEAPPEND(
    v_file, LENGTH(v_buffer) + v_eollen, v_buffer || v_eol
    END IF;
    v_buffer := r.csv;
    END IF;
    v_lines := v_lines + 1;
    END LOOP;
    IF LENGTH(v_buffer) > 0 THEN
    DBMS_LOB.WRITEAPPEND(
    v_file, LENGTH(v_buffer) + v_eollen, v_buffer || v_eol
    END IF;
    DBMS_XSLPROCESSOR.CLOB2FILE(Xfile, v_dir, 'V_DESC,TXT');
    DBMS_LOB.FREETEMPORARY(v_file);
    Exception
    When Others Then
    dbms_output.put_line('Error '||v_lines||' --'||SQLERRM) ;
    dbms_output.put_line('Error '||dbms_lob.getlength(Xfile)) ;
    End ;
    Thanks

    Well, ORA-21560 could indicate file opening issue. Check the file name 'V_DESC,TXT'. Most likely your UNIX either does not allow commas in file name or requires them to be escaped. And anyway, I believe it is a typo and you meant 'V_DESC.TXT'.
    SY.

  • Carriage Return in External table column

    Im using Oracle 9.2.0.6 . On Aix.
    Ive created and external table pointing to a csv file.
    When I do a select on the last column of the external_table, it contains a carriage return / linefeed. If I try to make the colums specification smaller then it throws and error
    ORA-01401: inserted value too large for column
    How can I eliminate this unwanted character.
    line from csv file
    2,,,,,,,,,,,,,,BB
    table spec
    create table x_needsprop
    external_prop_ref varchar2(20),
    floor_level     varchar2(20),
    dcc     varchar2(4),
    lc     varchar2(4),
    ptd     varchar2(4),
    wc     varchar2(4),
    ec     varchar2(4),
    rspr     varchar2(4),
    err     varchar2(4),
    ctb     varchar2(4),
    bd     varchar2(4),
    nda     varchar2(4),
    ndd     varchar2(4),
    vsam     varchar2(4),
    res_type varchar2(5)
    ORGANIZATION EXTERNAL
    ( type oracle_loader
    default directory external_dir
    access parameters
    ( fields terminated by ',' )
    location ('needsprop.csv')
    /

    According to the documentation, adding the trim specifer 'RTRIM' directs that "spaces should be trimmed from the end of a text field. Spaces include blanks and other nonprinting characters such as tabs, line feeds, and carriage returns."
    create table x_needsprop
    external_prop_ref varchar2(20),
    floor_level varchar2(20),
    dcc varchar2(4),
    lc varchar2(4),
    ptd varchar2(4),
    wc varchar2(4),
    ec varchar2(4),
    rspr varchar2(4),
    err varchar2(4),
    ctb varchar2(4),
    bd varchar2(4),
    nda varchar2(4),
    ndd varchar2(4),
    vsam varchar2(4),
    res_type varchar2(5)
    ORGANIZATION EXTERNAL
    ( type oracle_loader
    default directory external_dir
    access parameters
    ( fields terminated by ',' RTRIM)
    location ('needsprop.csv')
    )

  • 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)  

  • Default Carriage return in the last column when data is downloaded to Excel

    Problem:
    When you download data into Excel and if the last column of your excel is a numeric field, XMLP will add a carriage return (special character) to your numeric field. This feild will be considered as character field by excel.
    Work Around:
    When you build the template, create an empty column as your last column and leave E (or end-for-each) in that empty column.
    Note:
    If the last column is a character column then you do not have to do this.

    I originally had that END:VCARD without any carriage return.
    But I still get an extra carriage return at the end when the JSP renders to VCF
    I'm using Tomcat running on Linux.
    I found this, article which implies (but does not explicitly say) JSP in general adds a newline to the last line:
    http://www.caucho.com/resin-3.0/jsp/faq.xtp (But its not tomcat either, so maybe this info is irrelevant).
    Edited by: shogo2040 on Dec 22, 2008 3:31 PM - changed rendered to VCF from rendered to JSP

  • Add a carriage return in a Unbound String Field

    Post Author: Razzle00
    CA Forum: Formula
    Hi,
         How can I add a carriage return to an unbound string field in a crystal report.  I am using the bundled version of CR with MS Visual Studio 2003 & 2005.  My formula needs to look something like this....
    'Heading One:' + CARRIAGE RETURN + trim({tablename.fld_1}) + CARRIAGE RETURN + 'Heading Two:' + CARRIAGE RETURN  + trim({tablename.fld_2})
    this code all needs to be in 1 unbound string field.  Is this possible?
    Thanks,
    Razzle

    Post Author: SKodidine
    CA Forum: Formula
    To add a carriage return, add CHRW(13)
    For example:
    'Heading One:' & chrw(13) & 'sample text';
    will result in:
    Heading One:
    sample text

  • Carriage return in textarea - how do I check for and remove it???

    I have an html form that has a <textarea> element for user input. I work mainly with Java and some JavaScript. Since carriage returns are permitted in a <textarea> element, upon retrieving the value submitted, my Java and/or JavaScript variables contain carriage returns as well, making the values incomplete.
    For Example :
    String dataSubmitted = request.getParameter("formInput");
    <script language="JavaScript">
    var textValue = "<%=dataSubmitted%>";
    ....//do other stuff
    </script>When I view the source of my JSP page, the above statement of code looks like this:
    var textValue = "This is some text that
    I submitted with a carriage return";I'm putting the text submitted through this form into a mysql database, and when I pull up the values I find that it has recorded the carriage return as well. There is an actual symbol representing a carriage return in the db field.
    What I'd like to do is use some Java code to go through each character of the String and find and remove the carriage return, perhaps replacing it with an empty space instead. But how do I check for a carriage return in a String variable?
    Also, is there a way to use JavaScript to alert the user when the carriage return button is pressed when they're in the <textarea>?
    Any input is appreciated,
    Thank You,
    -Love2Java

    What I'd like to do is use some Java code to go through
    each character of the String and find and remove the
    carriage return, perhaps replacing it with an empty
    space instead. But how do I check for a carriage return
    in a String variable?The carriage return is represented by the \r. Generally there is also a newline, the \n. You can use String#replaceAll() to replace occurences of them by a space.
    string = string.replaceAll("\r\n", " ");
    Also, is there a way to use JavaScript to alert the user
    when the carriage return button is pressed when they're
    in the <textarea>?You can capture keys using the 'onkeypress' attribute. The keyCode of a the return key is 13. So simply catch that:<textarea onkeypress="if (event.keyCode == 13) alert('You pressed the return button.'); return false;"></textarea>The return false prohibits the linebreak being inserted. If you remove that, then it will be inserted anyway.

  • What is escape character for for Carriage Return, Line Feed, Form Feed

    Hi
    I need to a text file which should have following characters
    Carriage Return, Line Feed, Form Feed
    How do i insert them in a string
    i know "\f" is carriage return,
    but what are characters for line feed and form feed
    Ashish

    uncle_alice wrote:
    jverd wrote:
    remus.dragos wrote:
    I forgot that it does not exist in Java. A good thing
    from my point of view.Running the following makes my computer beep.
    public class Bell {
    public static void main(String... args) {
    System.out.println("\u0007");
    Sure, sending a BEL character to the console rings the bell, but that has nothing to do with Java. Anyway, I think he meant Java doesn't support the \a escape sequence in string and char literals.
    >
    >
    >I forgot that it does not exist in Java. A good thing
    from my point of view.
    Running the following makes my computer beep.
    public class Bell {
    public static void main(String... args) {
    System.out.println("\u0007");
    } Sure, sending a BEL character to the console rings the bell, but that has nothing to do with Java. Anyway, I think he meant Java doesn't support the \a escape sequence in string and char literals.
    Ah, I thought he was saying Java doesn't support ringing the bell.

  • Handling Special character "Carriage Return" in PI

    Hi Experts,
    I have a scenario where JMs adapter is my source and is sending data which is of Fixed length.
    My problem is when JMS is sending the data in any of the incoming fields its passing a carriage return(0D- Hexadecimal character).
    When this character is coming the record is getting breaked into two or failing in my channel.
    Please guide me in handling this issue and to remove this character from the record.

    Hi,
    U can handle this issue by ant of these...
    1. U can ask the third party sending messages in JMS to replace the carriage return character by none or empty.. when they are sending it to the messaging system.
    But i dont think so they are ready to do it....
    2.No problem. U can handle this in the mapping itself.
    When the record is breaking because of carriage return, u will receive a new record.
    In UDF check the length of each record. If it is less than the Fixed Length we are expecting then combine these 2 records into one.
    Still less than the Fixed length append 3rd one also.. so on.
    U can go for one extra graphical mapping for this.
    And then other mapping which u will use noramally.
    in Operation Mapping specify them in sequence.
    Babu

  • Removing Carriage Returns

    I have a table with a field that contains data such as this,
    and I want to remove all of the carriage returns but I am having
    difficultiy. I have tried replacing the chr(13) and the chr(10) but
    no such luck. Can anyone help? Thanks!
    ==== start of code block ====
    Part Number: 1307 G9<BR>
    Finish Family:
    CHROMES<BR>
    Finish/Color:
    STERLING NICKEL<BR>
    Dimensions:
    1 1/4 INCH DIAMETER<BR>
    Collection:
    BRASS &amp; STERLING TRADITIONS<BR>
    ==== end of code block====

    Hi,
    For me both database as well as coldfusion worked fine. You
    may also please try with small example.
    Method 1:
    At database side
    select
    replace(columnname,chr(13)||chr(10),' ') as columnname
    from <tablename>
    Method 2: Coldfusion
    <cfset pageContent = reReplace(pageContent,
    chr(10)&chr(13),"", "all" )>
    I noticed that the regular expression functions in CF support
    the newline character \n Chr(10), carriage return \r Chr(13), and
    tab \t Chr(9).
    <cfsavecontent variable="data">
    here is my
    break
    </cfsavecontent>
    <cfoutput>#ReReplace(data, "\n", "<br />",
    "ALL")#</cfoutput>
    Method 3: Coldfusion.
    Please go through the below article. Example is mentioned
    http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt248.htm
    Hope this helps. Please try it out.
    Satheesh.

Maybe you are looking for