Single Quote in Select Search

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