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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL - Selecting by field with & in it

Re: SQL - Selecting by field with & in it

From: <coakleyj_at_hotmail.com>
Date: Tue, 16 Mar 1999 18:09:46 GMT
Message-ID: <7cm6p1$icc$1@nnrp1.dejanews.com>


The following will work

select * from <the table>

   where st_name like 'O''Reilly ' || '&' || ' Smith'

Use single quotes everywhere - remember that 2 single quotes together yields one quote within a string.

Also, you have to break up the search criteria as '&' will otherwise be recognised as a substitution variable. John

> Christopher Latta wrote in message
> <7cl083$3uc$1_at_reader1.reader.news.ozemail.net>...
> >I'm trying to run a select statement through Delphi 4 C/S to Oracle 8 like:
> >
> >SQL.Text := 'SELECT * FROM PHONEBOOK WHERE SEARCHKEY = ''O''Riley &
> >Smith''';
> >
> >That is, the search value is:
> >
> >O'Riley & Smith
> >
> >I'm getting a "missing right quote" error. I have isolated this to the
> >ampersand, as this is used in Oracle 8 to allow interactive queries, where
> >the query prompts you for values before creating the row.
> >
> >Is there any way to select on such a value? Double ampersands don't
> work....
> >
> >Christopher Latta
> >
> >
>
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Mar 16 1999 - 12:09:46 CST

Original text of this message

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