Instead of balckslah (\), using single quote ('). For your example, the query
is like: select * from name_table where name like '%''%'.
-- Laiwu
"Doshi, Gunjan" wrote:
> Tried it:
> This is the result
> COM.ibm.db2.jdbc.app.DB2Exception: [IBM][CLI Driver][DB2] SQL0104N An
> unexpected token "%" was found following "". Expected tokens may include:
> "FOR WITH ORDER UNION EXCEPT OPTIMIZE ". SQLSTATE=42601
>
> > ----------
> > From: Laiwu Luo[SMTP:[EMAIL PROTECTED]]
> > Reply To: A mailing list for discussion about Sun Microsystem's Java
> > Servlet API Technology.
> > Sent: Friday, May 12, 2000 4:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Database and Servlet
> >
> > Put a blackslash (\) in front of the single quote (') should fix your
> > problem.
> > For you particular example,
> > the quer should look like: select * from name_table where name like
> > '%\'%'.
> >
> > -- Laiwu
> >
> > "Doshi, Gunjan" wrote:
> >
> > > Friends:
> > >
> > > My Servlet queries the DB2 database table. However some entries in the
> > > column have ' as its entries. I want to search for all of them
> > >
> > > Example: O' Peter. I am talking of the single quote ' in the name.
> > >
> > > So when I say select * from name_table where name like '%'%'
> > >
> > > It is wrong because single quotes because %'% is illegal within ' '.
> > How do
> > > I do it.
> > >
> > > Gunjan
> > >
> > >
> > __________________________________________________________________________
> > _
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources: http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> > --
> > Laiwu Luo
> > Global Crossing Telecommunications, Inc.
> > Systems & Product Development
> > Email: [EMAIL PROTECTED]
> > Phone: 248-647-6920 Ext. 4010
> >
> > __________________________________________________________________________
> > _
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
--
Laiwu Luo
Global Crossing Telecommunications, Inc.
Systems & Product Development
Email: [EMAIL PROTECTED]
Phone: 248-647-6920 Ext. 4010
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html