Replace CRLF with CHR(13) to preserve new lines in Oracle
This example uses Perl to look for a CRLF and replace it with the the proper ASCII, it also concatenates it for Oracle:
$text =~ s/(?:\r\n|[\r\n])/' || chr(13) || '/g;
So, if you wanted to insert the following and preserve line breaks...
Line 1
Line 2
...you can generate the following SQL:
insert into table values ('Line 1' || chr(13) || 'Line 2');
$text =~ s/(?:\r\n|[\r\n])/' || chr(13) || '/g;
So, if you wanted to insert the following and preserve line breaks...
Line 1
Line 2
...you can generate the following SQL:
insert into table values ('Line 1' || chr(13) || 'Line 2');
