Home » SQL & PL/SQL » SQL & PL/SQL » wildcard character (Oracle, 10g, Windows server 2003)
wildcard character [message #437031] Wed, 30 December 2009 07:20 Go to next message
getritesh
Messages: 235
Registered: July 2006
Location: INDIA
Senior Member

Hi,

Check my scenario

My project has Microsoft sharepoint as frontend and oracle as backend.
Now % is a wildcard character in oracle as known.

Frontend has one user interface textbox named "Name" in which user enters any character or string to search records which containing that character or string.(Oracle query with LIKE keyword)

Problem is if end user enters % in Name textbox it brings all records


I want only those records to come in which '%' character is present literally.


Please provide me a solution for this

Regards,
Ritesh
Re: wildcard character [message #437032 is a reply to message #437031] Wed, 30 December 2009 07:25 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Search for Q Quote Literals on Google.

regards,
Delna
Re: wildcard character [message #437033 is a reply to message #437031] Wed, 30 December 2009 07:42 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Put a CASE or DECODE into the query to trap situations where the search term is '%'
Re: wildcard character [message #437034 is a reply to message #437032] Wed, 30 December 2009 07:43 Go to previous messageGo to next message
getritesh
Messages: 235
Registered: July 2006
Location: INDIA
Senior Member

Hi,
can u please explain me in brief what necessary changes i have to make in query



Regards,
Ritesh
Re: wildcard character [message #437082 is a reply to message #437031] Wed, 30 December 2009 23:22 Go to previous messageGo to next message
ayush_anand
Messages: 417
Registered: November 2008
Senior Member
for example:
Make changes in frontend to replace '%' by a character like '#@#$#@'
and search for the same in the query also

[Updated on: Wed, 30 December 2009 23:23]

Report message to a moderator

Re: wildcard character [message #437087 is a reply to message #437034] Wed, 30 December 2009 23:49 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
See example of Q Quote Literals.

Another way is
SQL>select * from t13;

COL1
--------------------
asdf
asdf%ghjk
%1234
1234%
asdf%
%asdf
1234

7 rows selected.

SQL>select * from t13
  2   where instr(col1,'%') > 0;

COL1
--------------------
asdf%ghjk
%1234
1234%
asdf%
%asdf

5 rows selected.


regards,
Delna
Re: wildcard character [message #437178 is a reply to message #437031] Thu, 31 December 2009 13:22 Go to previous message
cookiemonster
Messages: 12320
Registered: September 2008
Location: Rainy Manchester
Senior Member
Or you could just use an escape character. See the example in the docs here.
Previous Topic: How to find out last DML operation in a table which does not have date field
Next Topic: dbms_jobs
Goto Forum:
  


Current Time: Thu Sep 29 03:56:34 CDT 2016

Total time taken to generate the page: 0.18183 seconds