Re: Single Quote in Select Search

Re: Single Quote in Select Search

 

  

select loginname from userprofile where loginname like '%''%';

----- Original Message -----
From: Viswanadha P.Reddy
To: LazyDBA.com Discussion
Sent: Wednesday, July 31, 2002 9:33 AM
Subject: Re: Single Quote in Select Search


Dear list,

i am also looking same thing in java Application.

Regards
Reddy
----- Original Message -----
From: sean feifer
To: LazyDBA.com Discussion
Sent: Wednesday, July 31, 2002 11:57 AM
Subject: Single Quote in Select Search


Hi,

I am trying to find a way to write a select statement that can recognize single quote. The situation is,

In a SEARCH form used on a website , a select statement is used to select title or name when a Search Keyword is given. The statement behind the form is

select * from table where title or name='SEARCH KEYWORD';

Some of the title or name contains " ' " , such as VIP'S. The above statemet will create error if the Search Keyword contains an " ' " like VIP'S. I understand to select single quote in sql statement should be like ' select * from table where title=' VIP''S'. But how can I correct the above statement to recognize a single quote contained in the Search Word? When people put in search key word, they are not going to put an extra ' before a single quote.

Appreciate your help!

Sean









----------------------------------------------------------------------------
Do You Yahoo!?
Yahoo! Health - Feel better, live better
Oracle LazyDBA home page