-
Junior Member
Using LIKE operator in multiple condition
If we have multiple conditions to check, can we use like operator?
eg where empid like ('123%') or like ('23%')?
-
Expert Member
Re: Using LIKE operator in multiple condition
The LIKE operator is used in character string comparisons with
pattern matching.
If empid is defined as varchar Then
select * from emp where empid like '123%'
retrieve records of emp where empid starts with 123
select * from emp where empid like '23%'
retrieve records of emp where empid starts with 23
-
Re: Using LIKE operator in multiple condition
Like operator is used to retrieve records starting with the alphabet or numeric specified as the condition. For example,
Select * from emp where emp_name like 'Joh%'
This statement will retrieve the records where the employee name starts with "Joh"
-
Re: Using LIKE operator in multiple condition
LIKE operator is used for pattern matching you can combine multiple statments for different conditions using logical operators.
-
Junior Member
Re: Using LIKE operator in multiple condition
u can combine like operator in multiple condition
for eg. where (name like 'abc%' or name like 'pqr%');
-
Junior Member
Re: Using LIKE operator in multiple condition
I have a table like employee containing name column.
In name it contains:- SMITH,MARTIN,MILLER,ADAMS etc.
I want a result from name whose first character is 'M', Second character can be any, But third character should not be 'R'.
select name from employee where name like 'M_[^R]%' is fetching 0 results.
Please suggest a query for oracle server.
-
Re: Using LIKE operator in multiple condition
You need to use REGEXP_LIKE for the purpose.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules