Results 1 to 4 of 4

Thread: How to deal with oracle character query in Wildcard

  1. #1
    Join Date
    Apr 2009
    Posts
    107

    How to deal with oracle character query in Wildcard

    How do I make a SELECT statements where I want results from everything that starts with certain letter? let suppose in the excel file there are list of member name and if i wanted to find out the letter starting with letter "D" Is there a way to limit the query expansion to only, say 100, results that get returned from the index? Please help.

  2. #2
    Join Date
    Dec 2008
    Posts
    183

    Re: How to deal with oracle character query in Wildcard

    Developers generally tend to use characters such as % as a delimiter for storing data in an Oracle database. Here you can also use the same select statement,

    SELECT .....
    FROM ...
    WHERE NAME LIKE 'A%'

    The "%" is a wildcard symbol. So in the above query, I am looking anyone whose name begins with "D". I can also use

    WHERE NAME LIKE '%Rajesh%';

    The above will look for names with RAJESH within its string.

    WHERE NAME LIKE 'RAJEEV%'

    will look for names with RAJE as the first four characters.

  3. #3
    Join Date
    Dec 2008
    Posts
    202

    Re: How to deal with oracle character query in Wildcard

    Oracle views the % character as a Wildcard character, it can't use it as a delimiter effectively.

    SELECT *
    FROM wildcard
    WHERE test LIKE '23_5';

    Fortunately, Oracle provides a way out for such a problem—the ESCAPE character. To avoid the error, you can increase your WILDCARD_MAXTERMS. If that is not sufficient, then you have to use something more restrictive. The ESCAPE keyword comes handy when you have a character in your data which is same as a Wildcard character.

  4. #4
    Join Date
    Apr 2008
    Posts
    193

    Re: How to deal with oracle character query in Wildcard

    The wildcard_maxterms is the number of distinct words that begin with auto, such as automotive, automobile, automatic, and so on. If there are more such distinct words in your index, then you get the error. Your query will look like this:
    SELECT ObjectID FROM ObjectTable WHERE ObjectID LIKE '1\%%' ESCAPE '\'

    Here the keyword ESCAPE and the character in the quotes (\) specifies that there is a escape character and the character is specified in the quotes.

Similar Threads

  1. Query in SQL v/s Query in Oracle
    By Satchel in forum Software Development
    Replies: 4
    Last Post: 29-12-2010, 07:19 AM
  2. Query for columns in oracle database
    By Gerri in forum Windows Software
    Replies: 4
    Last Post: 10-02-2010, 08:27 PM
  3. What are the different Wildcard characters in SQL?
    By Leana_rus in forum Software Development
    Replies: 3
    Last Post: 25-11-2009, 10:58 AM
  4. How to Setup Wildcard DNS
    By ReD-GuY-ReD-HaT in forum Operating Systems
    Replies: 3
    Last Post: 01-08-2009, 06:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,399,936.63867 seconds with 16 queries