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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Question regardin replacing the value in a column

Re: Question regardin replacing the value in a column

From: Douglas Hawthorne <douglashawthorne_at_yahoo.com.au>
Date: Fri, 26 Mar 2004 10:08:50 GMT
Message-ID: <SiT8c.125250$Wa.53954@news-server.bigpond.net.au>


"Thomas Kellerer" <IQEWDSUVEDDF_at_spammotel.com> wrote in message news:c40kri$2cr4hs$1_at_ID-13919.news.uni-berlin.de...
> On 26.03.2004 05:34 Praveen wrote:
> > Hi..All,
> >
> > DB : Oracle 8i
> >
> > I have a column in a table which is of type varchar. It can contain
> > characters like &, <, > etc along with all other characters.
> >
> > now, I want to replace them with some other characters when I select the
> > column
> >
> > & to &amp;
> > < to &lt;
> > > to &gt;
> >
> > for eg if the column had the value <pass & fail>
> >
> > when I execute the SQL
> > select column from table; I should get &lt;pass &amp; fail&gt;
> >
> > I do I write one single SQL to achieve this.
> >
> Have a look at the REPLACE function, that should do what you want (you
have to
> nest several calls to the function)

>
> Thomas

Thomas,

Since what the OP wants to do is to escape the standard XML characters, I suggest that a call to DBMS_XMLGEN.CONVERT() is more appropiate here. See p.85-7 of "9i Supplied PL/SQL Packages and Types Reference".

SQL> SELECT dbms_xmlgen.convert('&<>') FROM dual;

DBMS_XMLGEN.CONVERT('&<>')


&amp;&lt;&gt;

Douglas Hawthorne Received on Fri Mar 26 2004 - 04:08:50 CST

Original text of this message

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