Last active
December 15, 2015 19:08
-
-
Save velppa/5308630 to your computer and use it in GitHub Desktop.
Replaces multiple newlines into single one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with a as | |
(select q'{ | |
Line 1 | |
Line 2 | |
Line 3 | |
Line 4 | |
Line 5 | |
}' l from dual | |
) | |
select regexp_replace(a.l,'('||CHR(10)||'[[:space:]]*'||CHR(10)||'){2,}',CHR(10)||CHR(10)) a | |
from a; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assumes that new line is \n symbol. If it's \r\n, then replace CHR(10) with CHR(13)||CHR(10).