Connecting Tech Pros Worldwide Forums | Help | Site Map

between operator in oracle

Newbie
 
Join Date: Jul 2009
Posts: 5
#1: Jul 17 '09
when i am searching the names in range with following query

select * from salesman where name between 'a%' and 'c%';

it does not display the names starting from c; it displays the name which starts from a and b. why it is so?

amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#2: Jul 20 '09

re: between operator in oracle


Try this query:

Expand|Select|Wrap|Line Numbers
  1.  
  2. select * from salesman where name LIKE 'a%' OR name LIKE 'c%';
  3.  
  4.  
Newbie
 
Join Date: Jul 2009
Posts: 5
#3: Jul 22 '09

re: between operator in oracle


I want to search the names whose intial starts from a to c
with your answer i can find only those names which starts from a or b
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#4: Jul 22 '09

re: between operator in oracle


oops, silly mistake.here is the query:

Expand|Select|Wrap|Line Numbers
  1.  
  2. select * from salesman where UPPER(SUBSTR(name,1,1)) between 'A' and 'C';
  3.  
  4.  
Reply