DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Newline character in a column!

  1. #1
    Join Date
    Jun 2004
    Posts
    125

    Newline character in a column!

    How do you check for a newline character in a column with some text in Oracle 8i? Thanks.

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Code:
    SELECT my_column, INSTR(my_column, CHR(10)) AS position_of_first_NL
    FROM my_table;
    Note that in above, CHR(10) is the standard ASCII code for line_feed (LF). Depending of the OS, the standard newline (NL) character sequence might be just LF, or it might be the sequence of CR+LF. In such case, repleced the above CHR(10) with CHR(13)||CHR(10)
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Today's prize question - for 1¢ to be collected from me personally:

    For what historical reason is it CR+LF and not LF+CR ?

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    The way typewriters used to operate in the pre-computer era?
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  5. #5
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Originally posted by jmodic
    The way typewriters used to operate in the pre-computer era?
    Close, but not good enough.

    Come to think of it (several hours later) manual typewriters did (or still do) LF+CR.
    Last edited by DaPi; 04-09-2005 at 03:46 AM.

  6. #6
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Ok, DaPi, you've obviously saved yourself 1¢. But now, don't keep us waiting any more, tell us the correct answer. Tell us, tell us, tell us!
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  7. #7
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Back in the dark ages, the most common "interactive" device was the Teletype(TM) (which explains tty in Unix). They were slow; CR was very sloooooow - the print head perhaps had to move all the way from RH to LH margin. CR+LF was faster than LF+CR because the LF could take place during the CR. On some models, LF+CR+X could even cause the X to print in the middle of the page, CR+LF+X put the X at the LH margin.

  8. #8
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Nice! I'll (try to) remember this one.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  9. #9
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Good input, Dapi.

    Tamil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width