Connecting Tech Pros Worldwide Help | Site Map

how to count no of times a letter occurs in oracle

Newbie
 
Join Date: Jul 2008
Posts: 29
#1: Sep 19 '08
im trying get the occurence of a particular letter and then depending on that result i have to find the name from table that has more than 1 occurence of particular letter
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#2: Sep 19 '08

re: how to count no of times a letter occurs in oracle


occurance of particular letter from where?...I assume you want those column values which has occurance of particular letter n times??

n - occurance count of a particular letter
Newbie
 
Join Date: Jul 2008
Posts: 29
#3: Sep 19 '08

re: how to count no of times a letter occurs in oracle


for example there are three names in table

ADAMS
DAVE
SMITH

i should get the name that has two A's in it
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,500
#4: Sep 20 '08

re: how to count no of times a letter occurs in oracle


you need to use string functions like SUBSTR,INSTR and LENGTH for the prpose.
Newbie
 
Join Date: Feb 2009
Posts: 2
#5: Feb 5 '09

re: how to count no of times a letter occurs in oracle


Hi,
can u explain with an example


Regards,
raj
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#6: Feb 6 '09

re: how to count no of times a letter occurs in oracle


Try this:

Expand|Select|Wrap|Line Numbers
  1. SQL> select * from emp where address like '%A%A%';
  2.  
  3.      EMPNO ADDRESS
  4. ---------- --------------------------------------------------------------------------------
  5.         10 ADAM
  6.         20 123 abc road, texas,USA - 123
  7.  
  8. SQL> 
  9.  
Reply