How to identify a linefeed character in a string

I have a table with some data in a VARCHAR2 column that contains linefeed characters.
These were entered by users pressing 'return' when in a web text box.
I want to get rid of these using the REPLACE function, but I'm having trouble identifying them.
If I have the following sample data:
CREATE TABLE test (text VARCHAR2(100));
INSERT INTO test VALUES ('Sample Text one line');
INSERT INTO test VALUES (
'Sample Text '||chr(10)||
'two lines');
INSERT INTO test VALUES (
'Sample '||chr(10)||
'Text  '||chr(10)||
'three lines');
SELECT * FROM test;Then I'd like to identify them using something like...
SELECT text FROM test WHERE text LIKE '%CHR(10)%';but that obviously doesn't work.
How can I find them?
Thanks.

cd beats me ;)
michaels>  CREATE TABLE TEST (ID INTEGER,text VARCHAR2(100))
Table created.
michaels>  INSERT INTO TEST
     VALUES (1, 'Sample Text one line')
1 row created.
michaels>  INSERT INTO TEST
     VALUES (2, 'Sample Text ' || CHR (10) || 'two lines')
1 row created.
michaels>  INSERT INTO TEST
     VALUES (3, 'Sample ' || CHR (10) || 'Text  ' || CHR (10) || 'three lines')
1 row created.
michaels>  SELECT ID, text
  FROM TEST
WHERE text LIKE '%' || CHR (10) || '%'
        ID TEXT                                                                                               
         2 Sample Text                                                                                        
           two lines                                                                                          
         3 Sample                                                                                             
           Text                                                                                               
           three lines                                                                                        
2 rows selected.

Similar Messages

  • How to change a certain character in a string?

    hi,
    how can i change a certain character in a string. Lets say i have a string s="0000" and i want to change the last character (s.charAt(3)) to be a 1. how would i go about doing so?

    i did this
    num.charAt(lspace) = s.charAt(i+1);and am getting an errorThat's because you can't do that. You should go for one of the alternatives mentioned above.
    Kaj

  • How to identify 'Ctrl+M' character in a file.

    Hi!
    I have a problem in identifying 'Ctrl+m' or 'Ctrl+M' character in a given String or a file.
    Any one knowing, how to achieve this is Welcomed.
    This character(Ctrl+M) is not visible in DOS-Editor, Notepad, Eclipse, or TextPad.
    I can identify this characters existence in a given String or File only in Vi-editor(Unix).
    Help needed ASAP.
    Thanks in Advance.

    What you see is probably they way windows has line terminations.
    Windows = \r\n
    Unix \n
    The \r is displayed as ^M when you look at the textfiles on unix.
    I.e. You should look for the character '\r'
    /Kaj

  • Identify Non English Character in a String

    All,
    We have a requirement to Identify the Non English Characters from the User Key In data and return an error message saying only valid English, Numeric and some special characters are allowed.
    For Example, If the User enters data like "This is a Test data" then the return value should be true. or if he enters something like "My Native Language is inglés" then it should return false. Similarly any Chinese, russian or japansese character entryies should also return false.
    How can we achieve this?
    Thanks,
    Nagarajan.

    Hi Nagarajan,
    You could use Unicode character blocks or simply craft a regular expression that contains all the characters you need. The latter is easy to understand and gives you full control over which characters you want to allow. E.g. I assume you might want something like this:
    if(!"This is a proper input string".matches("[\\s\\w\\p{Punct}]+")) {
      // Issue error message and re-get input string
    The String method matches() takes a regular expression as input parameter. If you haven't dealt with regular expressions before, check out the Java API help for class java.util.regex.Pattern. Here's a short breakdown of the pattern I used:
    <ol>
    <li>The square brackets [] enclose a list of allowed characters; here you can explicitly list all allowed characters.</li>
    <li>You can specify ranges like a-z as a character class, list individual characters like ;:| or utilize predefined character classes (\s for any whitespace character, \w for all letters a-z and A-Z, underscore and 0-9 and the posix class \p for a list of punctuation symbols). For a complete list check Java API help on java.util.regex.Pattern.
    <li>The + at the end indicates that the characters listed can occur once or more.</li>
    </ol>
    There's other ways to achieve what you want, but I think this might be an easy way to start with.
    Cheers, harald

  • How to handle an invisible character in a string?

    Hi,
    I have an interesting situation-
    select bac_person_id, length(bac_person_id) from bkmap_personid_stg where BAC_PERSON_ID like '%27136317%'
    The result is -
    BAC_PERSON_ID|LENGTH(BAC_PERSON_ID)
    27136317|     9
    I don't know what is the invisible character here?
    It is certainly not a blank character as trim is not working -
    select * from bkmap_personid_stg where trim(BAC_PERSON_ID) = '27136317'
    no records!!
    But substr does give me the resullt -
    select * from bkmap_personid_stg where substr(BAC_PERSON_ID,1,8) = '27136317'
    How can I know which is the last character? and How to handle it?

    girija_pathak wrote:
    How can I know which is the last character? and How to handle it?You use the DUMP() function in SQL in order to see the actual content of the column.
    E.g.
    select DUMP(bac_person_id) from bkmap_personid_stg where bac_person_id like '%27136317%'
    The decimal character values will be displayed - enabling you to see where and what control characters characters exist in the string value for that column.

  • How to get the numeric character in a string

    Hi Experts,
    I have the following requirement.
    I am double clicking on the number of a string and I need to get the number as the output.
    I have string  like
    String1 : "Account Number 19292 is closed"  I am double clicking on 19292
    I want the output as 19292
    String2 : "AccountNumber19292isclosed"   I am double clicking on 19292
    I want the output as 19292
    String3: "Account Number1929 2 isclosed"  I am double clicking on 1929
    I want the output as 1929 and not 19292
    String4 :"Account Number 1929 2is closed" I am double clicking on 2
    I want the output as 2.
    Thanks in Advance,
    Raju

    Hi Raju,
    All possible solutions should more or less do the following two steps:
    <ol>
    <li>Check if at the given offset is a number: If yes, retain all consecutive numeric characters from the offset; otherwise stop.</li>
    <li>Retain any consecutive numeric characters preceding the number at the given offset and remove all other characters</li>
    </ol>
    Pretty trivial stuff, but the interesting challenge is actually to come up with the solution with least amount of coding (and ideally still understandable). I have a solution that is pretty short, though not really obvious for people not knowing about regular expressions...
    So here's the coding (relevant part in the form) and a quick test harness to check out what it does:
    data:
    TXT type STRING,
    NUM type STRING,
    OFF type I,
    LEN type I.
    TXT = '0Account12 Number 345 6 78isclosed9.9'.
    LEN = strlen( TXT ).
    do LEN times.
      OFF = SY-INDEX - 1.
      perform EXTRACT_NUMBER using    TXT
                                      OFF
                             changing NUM.
      write: /(3) OFF, ':', (5) NUM, TXT(OFF) inverse no-gap, TXT+OFF.
    enddo.
    * Return number at given offset in string (empty if no number present)
    form EXTRACT_NUMBER using    TXT        type STRING
                                 VALUE(OFF) type I
                        changing NUM        type STRING.
      NUM = TXT.
      replace regex '^(\d+).*$' in section offset OFF of NUM with '$1'.
      if SY-SUBRC = 0.
        replace regex '^.*[^\d](\d*)$' in NUM with '$1'.
      else.
        NUM = ''.
      endif.
    endform.
    I think this should match your requirements. Let's see if somebody comes up with a solution with less lines...
    Cheers, harald

  • How to get each character in a string

    as in 'C' we use arrays to get each character of a string stored in array.how can we get each character of a string stored in a variable.

    Hi,
    For that you need to do offset.
    for example one variable called VAR contains string 'HUMERAH'.
    if you want each character of that string then you need to decalre as many variable as the number of string.
    like
    data : var1(1),
             var2(1),
    var(3),
    var(4).
    var1 = var+(1).
    var2 = var+1(1).
    var3 = var+2(1).
    var4 = var+3(1).
    now var1,var2,var3,var4. contains the single characters.
    Regards,
    Guru
    mark helpful answers

  • Occurence of character in a string

    How can i find how many occurrence of a character in a string?
    Let's say: 010101010101010: there is 8 0 in that string.

    Here's just a different take on the same old problem, tested on 10g ... ;-)
    WITH t AS (SELECT '010101010101010' col1
                 FROM dual
    SELECT SYS_CONNECT_BY_PATH(symbol || ':' || TO_CHAR(no_of_sym), ' ') sym_stat
      FROM (SELECT SUBSTR(t.col1, LEVEL, 1) symbol
                 , COUNT(*)                 no_of_sym
                 , ROW_NUMBER() OVER (ORDER BY SUBSTR(t.col1, LEVEL, 1)) rn
              FROM t
           CONNECT BY LEVEL <= LENGTH(t.col1)
             GROUP BY SUBSTR(t.col1, LEVEL, 1)
    WHERE connect_by_isleaf = 1
    START WITH rn = 1
    CONNECT BY PRIOR rn = rn - 1
    => "0:8 1:7"C.

  • NewLine Character in the String received from Interactive Adobe Form

    Hello Experts,
    Following is the issue we have with interactive Adobe Form
    We have a text area within the form. User enters the text in multiple lines in this text area.
    We are calling a backend function module designed in SE37 that accepts and process the data from the adobe form.  We are also processing the string data user enters in the text area.
    When we receive the string from the form, the newline character within the string is displayed as '#' in the debugger. We tried splitting this string using cl_abap_char_utilities=>newline and cl_abap_char_utilities=>cr_lf  but NO luck. Though in the debugger we see cl_abap_char_utilities=>newline  as '#'  in the debugger and also '#' is present within the string, for some reason when string is processed to find cl_abap_char_utilities=>newline, we can find/locate it.
    Because ABAP code is not able to identify the newline character within the string received from Adobe form, we are not able to maintain the formatting of the string as it was entered in the form.
    Any help to resolve this issue is appreciated.
    Thanks in Advance.
    Regards,
    Bhushan

    Hi Bhushan,
    I was going through your issue, and I feel this is something you can do with scripting. Basically you should read whole string and find the new line character and replace with a space or comma, as per your requirment.
    Do like following:
    In the exit event of the field select java script and write following code:
    var strng = this.rawValue;
    strng.replace(/\n/g, " ");
    above im reaplcing new line with a space.
    I think it should work I have not tested it. Pls update if you test it .
    Regards,
    Ravi.D

  • How to identify which key figure will the numeric pointer for deltas?

    Hi All,
    I have created a numeric pointer for generic extraction ? but how to identify which key figure will the numeric pointer will use for deltas ?
    how to identify the key figures which is suitable for numeric pointer. And the generic extraction is based upon the copa table?
    Can anyone suggest me how the numeric pointer works and how to identify deltas are carried out at numeric pointer?
    Thanks
    Pooja

    Pooja,
    If you are using a generic extractor which is based on COPA table, then numeric pointer may not be the suggested delta extraction mechanism. 
    A time stamp would be the better one to use.  In a time stamp, you can give a lower limit value of 300 seconds.. so that it will try to fetch the missed records.
    Moreover, a delta would be based on a character, preferably a time char.
    In your requirement, try to figure out the character on whichdeltas will be based.
    Sasi

  • How can I increase the character limit of my text messages for Droid Maxx 4.4?

    How can I increase the character limit of my text messages for Droid Maxx 4.4?

    Send as a MMS.

  • How to add a new character set encoding?

    Hello,
    can anybody please explain to me, how to add a new character set encoding to Mac OS Tiger?
    I have two Mac laptops, a new one with Snow Leopard and an older one with Tiger, and on the old one i cannot use or enable anywhere the "Russian (DOS)" character set encoding, which i need to be able to use some old text files.
    On the Snow Leopard, this encoding is present in the list of available encodings of TextWrangler, but not in TIger.
    If i have understood correctly, this is not a problem of TextWrangler, and the same encodings are available systemwide.
    So, the question is: how to add new encodings to Tiger (or to Mac OS in general)?
    Thanks.

    I think possibly that's in the Get Info window of Finder?
    I don't think either that or the input menu have any effect on available encoding choices. Adding languages to system prefs/international/languages can do that, but once you have added Russian there, I don't know of any way to add an additional Russian encoding (there are quite a number of them).

  • How do I delete a character tag so it does not continue to show up in my designer.

    Hello.
    I have deleted a character tag from the catalog but it keeps showing up in the designer and stays associated with any new paragraph tag I try to create. How can I set the character designer to blank?
    Thanks

    >System Preferences>Mission Control>Show Desktop...should be F11:
    If not, change it.

  • How to identify missing records in a single-column table?

    How to identify missing records in a single-column table ?
    Column consists of numbers in a ordered manner but the some numbers are deleted from the table in random manner and need to identify those rows.

    Something like:
    WITH t AS (
               SELECT 1 ID FROM DUAL UNION ALL
               SELECT 2 ID FROM DUAL UNION ALL
               SELECT 3 ID FROM DUAL UNION ALL
               SELECT 5 ID FROM DUAL UNION ALL
               SELECT 8 ID FROM DUAL UNION ALL
               SELECT 10 ID FROM DUAL UNION ALL
               SELECT 11 ID FROM DUAL
    -- end of on-the-fly data sample
    SELECT  '[' || (id + 1) || ' - ' || (next_id - 1) || ']' gap
      FROM  (
             SELECT  id,
                     lead(id,1,id + 1) over(order by id) next_id
               FROM  t
      where id != next_id - 1
    GAP
    [4 - 4]
    [6 - 7]
    [9 - 9]
    SQL> SY.
    P.S. I assume sequence lower and upper limits are always present, otherwise query needs a little adjustment.

  • How to identify a type of consolidation in a system?

    Hi,
    I need to understand how to identify the type of consolidation we are doingion the system.
    Example like Step consolidation, Simultaneous consolidation or other method.
    This will be helpfull for me in doing my currest support issues.
    Thanks in advance,
    Richard..

    Not sure to understand your question.
    What is the precise context of your issue ? Is it a problem of SEM-BCS configuration or a general problem on how consolidation works ?

Maybe you are looking for