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

Home -> Community -> Usenet -> c.d.o.server -> Re: Question on how to mask characters in SQL ???

Re: Question on how to mask characters in SQL ???

From: Chris Colclough <chris.colclough_at_nospam.jhuapl.edu>
Date: Wed, 12 Aug 1998 08:52:14 -0400
Message-ID: <35D18FFE.8FBE2D08@nospam.jhuapl.edu>


One solution, though it's not as elegant as I'd like is as follows:

select column
from table
where replace(column,'%','^') like 'searchvalue^%'

That is, replace percent symbols in the text with carets (or any other character you choose) and then use the caret (or other character as appropriate) in the search string.
hth

cc

Michael Maretzke wrote:

> Hello there !
>
> I'm using a Oracle RDBMS and have a little problem. I know that some
> Characters are reserved characters in SQL. Inserting them into a
> CHAR-attribute in a table is no problem because they're masked
> by the single quoting marks ('). After inserting them ... how to
> select them from the table ?
> Using "SELECT * FROM table WHERE zzz = 'Test%Test';" works realy fine.
> But
> how can I select these lines using the LIKE condition ?
>
> "SELECT * FROM table WHERE zzz like '%%%';" doesn't work. I wanted
> to select all rows containing a % in attribute ZZZ ...
>
> Any suggestions ?
>
> Any tips on where to get these informations in Oracle docu ;)) ???
>
> CU Michael.
Received on Wed Aug 12 1998 - 07:52:14 CDT

Original text of this message

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