Home » SQL & PL/SQL » SQL & PL/SQL » Manipulation Function
Manipulation Function [message #1991] Fri, 14 June 2002 12:24 Go to next message
Harry Pasha
Messages: 1
Registered: June 2002
Junior Member
How do u calculate that how many (R) in my name(HARRY).and where they are.For example where is the 2nd a in my name Pasha.
Re: Manipulation Function [message #1993 is a reply to message #1991] Fri, 14 June 2002 13:00 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
This is a case-insensitive query (will count both 'R' and 'r').

sql>select name, 
  2         length(name) - length(replace(lower(name), 'r')) number_of_r,
  3         instr(lower(name), 'r', 1, 1) first_r,
  4         instr(lower(name), 'r', 1, 2) second_r
  5    from names;
 
NAME       NUMBER_OF_R   FIRST_R  SECOND_R
---------- ----------- --------- ---------
Harry                2         3         4
Todd                 0         0         0
Brent                1         2         0
Ron                  1         1         0
Previous Topic: Converting SQL to PL/SQL
Next Topic: Can Oracle PL/SQL call Shell Script / OS command
Goto Forum:
  


Current Time: Fri Apr 26 07:44:14 CDT 2024