Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Backslash and LTrim/RTrim
Sybrand Bakker <postbus_at_sybrandb.demon.nl> wrote in message
news:963520668.13257.0.pluto.d4ee154e_at_news.demon.nl...
>
> SQL> select replace(replace('\r\nChildren\r\n','\r'),'\n')
> 2 from dual;
But why not
replace('\r\nChildren\r\n', '\r\n') ?
But both the above mentioned methods will replace all the occurrences of
'\r\n',
while we need trim only leading and trailing ones.
I can't invent nothing better with pure SQL than too tricky
select substr(str, 1 + (min(i)-1) * lc,
length(str) - (min(j)+min(i)-2) * lc) from
(select rownum j from obj), (select rownum i from obj), (select '\r\n\r\nChil\r\ndren\r\n' str, '\r\n' cl, length('\r\n') lcfrom dual)
![]() |
![]() |