• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2758
  • Last Modified:

Oracle WildCards

In SQL Server I can use:
where columnname like '[A,D,X]%'
to find all values that start with an A or a D or an X.
I can also use:
where columnname like '[A-D,X]%'
to find all values that start with an A or a B or a C or a D or an X.
What is the corresponding syntax in Oracle
0
raykata2ddotcom
Asked:
raykata2ddotcom
1 Solution
 
sachinbCommented:
A way around could be:
1. substr(name,1,1) in ('A' ,'D'  ,'X')

2. (name between 'A%' and 'D%'  or name like 'X%')

hth
sachinb
0
 
raykata2ddotcomAuthor Commented:
I guess I should have been a little more specific in my request. My particular problem is that I was hoping to combine the following condition1 or condition2

columnname like '%A5%' or columnname like '%X5%'

into 1 condition

columnname like '%[A,X]5%'

To be even more difficult, what would I use if I wanted to have either a space or a comma before the 5?
0
 
waynezhuCommented:
No, Oracle does not have the corresponding syntax that
is the traditional UNIX wildcard style. Oracle SQL
only has % and _ wildcards.

0
 
kretzschmarCommented:
>I was hoping to combine the following condition1 or condition2

not possible, also such
>columnname like '%[A,X]5%'
is no sql standard
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now