Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Find line breaks on different systems
Originally posted by Bernhard Graeuler
> Hi,
>
> I have to split a string that contains line breaks into multiple
> strings.
> The problem is, that I don't know which linebreaks oracle uses. Is
> it always
> 'CR' or does it depend on the system (AFAIK Windows uses 'CRLF',
> MAC uses
> 'LF', UNIX uses 'CR').
>
> Do I have to check all possibilities in my stored procedure or
> is there
> another way to do this.
>
> I test the procedure by running a script file with the '@' command of
> sqlplus. In this file I use something like
>
> begin
> PACKAGE.SPLITLINE('This is
> a multiple
> line
> line.');
> end;
> /
>
> Confusing: Im using Windows, so I expected 'CRLF' as line break, but
> SPLITLINE only works correctly if it searches for 'CR'.
>
> Regards
>
> Bernhard
To be safe and OS independent, check separately for both.
IF ( (INSTR(string, CHR(13), 1, 1) != 0) OR
(INSTR(string, CHR(10), 1, 1) != 0) ) THEN
.....
END IF
Regards
/Rauf Sarwar
-- Posted via http://dbforums.comReceived on Fri Aug 01 2003 - 09:12:07 CDT