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: Safe to allow ' character in varchar fields?

Re: Safe to allow ' character in varchar fields?

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Wed, 03 Feb 1999 14:53:44 GMT
Message-ID: <36b9621e.62588417@inet16.us.oracle.com>


On Wed, 03 Feb 1999 12:49:58 GMT, adrianh_at_globalnet.co.uk (Adrian Harrison) wrote:

>I have a request by users to allow ' in varchar2 fields
>
>At the moment I stop them entering this character as it's used to denote strings
>
>Is it safe to allow it to be saved in to these fields or not?

Yes.

>
>Also how would you do an SQL wild card search on field that contain wildcard characters?
>Is this the way to do it "select * from mytable where mycol like '%%'; ?

You need to define an escape character.

eg.

SQL> select * from t;

        ID TEXT

---------- --------------------
         1 %ljkgldjgl
         1 sdfsd%sdfsd

SQL> select * from t where text like '/%%' escape '/';

        ID TEXT

---------- --------------------
         1 %ljkgldjgl



hope this helps.

chris.

>
>Thanks
>
>Adrian Harrison

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Feb 03 1999 - 08:53:44 CST

Original text of this message

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