If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > String Pattern Matching Progrom in Oracle using PL/SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-08-12, 02:41
gocool gocool is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
Red face String Pattern Matching Progrom in Oracle using PL/SQL

Hi everybody,
Can anybody help me out with the pattern matching program in oracle using PL/SQL.
Like, for example the input is : Assassins and the pattern is : ass, the output should be : 2 (i.e.,) it should show me the number of times the pattern is repeated. Try and please do reply me as soon as possible.

Thank you.
Reply With Quote
  #2 (permalink)  
Old 01-08-12, 11:22
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
REGEXP_COUNT (if you are on 11g).

I *think* that, reading through forums, I saw that Oracle Text is capable of doing that. I didn't use Oracle Text so I can't speak from my own experience, but Oracle Text CONTAINS Query Operators might be of use (DEFINESCORE, using OCCURRENCE(COUNT)).

Pure PL/SQL? Write a program.
Reply With Quote
  #3 (permalink)  
Old 01-09-12, 00:52
gocool gocool is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
hei,
I was actually browsin thru the net whole of yesterday and got an answer which goes like this...
select regexp_count('Assassins','ass',1) from dual;
Output : 2
the first parameter is the string passed, the next is the pattern to be found and the last parameter is the starting point from where you want the matching to be done...
Reply With Quote
  #4 (permalink)  
Old 01-09-12, 00:59
gocool gocool is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
Thank you, LittleFoot.. Infact i didnt see your answer.. thanks a lot dude
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On