Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Backslash and LTrim/RTrim

Re: Backslash and LTrim/RTrim

From: Alexander I. Doroshko <aid_at_grant.kharkov.ua>
Date: 2000/07/14
Message-ID: <8kmj9t$hkc@grant.grant.UUCP>#1/1

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') lc
   from dual)
 where
  substr(str, 1+(i-1)*lc, lc)<>cl
   and
  substr(str, length(str)+1-j*lc, lc)<>cl ;

Alexander I. Doroshko, Bank "Grant", Kharkov, Ukraine aid_at_grant.kharkov.ua Received on Fri Jul 14 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US