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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: RE: translate, replace...?

RE: RE: translate, replace...?

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Wed, 17 Sep 2003 08:59:47 -0800
Message-ID: <F001.005D03C3.20030917085947@fatcity.com>


Syntactically incorrect (one 'replace' too much). IMHO translate() is the one to use here. Probably a negligible performance benefit but I find a single function call easier to read than a function taking another function call as argument. The fewer characters the better (I type slowly and badly). My personal taste ...

SQL> get x
  1 select replace(replace('hello' || chr(13) || chr(10) || 'world',

  2                 chr(13),'R'),chr(10),' ')
  3* from dual
SQL> / REPLACE(REPL

helloR world

SQL> get x2
  1 select translate('hello' || chr(13) || chr(10) || 'world',   2 chr(13)||chr(10),'R ')
  3* from dual
SQL> / TRANSLATE('H



helloR world

SF

>----- ------- Original Message ------- -----
>From: "Hallas, John, Tech Dev"
><John.Hallas_at_gb.vodafone.co.uk>
>To: Multiple recipients of list ORACLE-L
><ORACLE-L_at_fatcity.com>
>Sent: Wed, 17 Sep 2003 07:59:43
>
>IA,
>
>The following code should be close to what you want
>
>
>select
>replace(replace(replace(a,chr(13),'R'),chr(10),''))
> from table
>
>John
>
>-----Original Message-----
>Sent: 16 September 2003 16:15
>To: Multiple recipients of list ORACLE-L
>
>
>Hi,
>
>I have a column with carriage returns (chr(13) )
>and line feeds (chr(10)). I
>want to select this column replacing the chr(13)
>with 'R' and chr(10) with '
>' .
>
>Whats the best way to do this?
>
>Regards
>
>IA
>--
>Please see the official ORACLE-L FAQ:
>http://www.orafaq.net
>--
>Author: Imran Ashraf
> INET: imran9a_at_hotmail.com
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriolecorp.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Sep 17 2003 - 11:59:47 CDT

Original text of this message

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