Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Looking for a SQL Function
To extend to the contributions in this thread so far, if the requirement were that the substring was a regex rather than a string literal, then the following snippet might prove useful.
The example demonstrates how to count the number of occurrences of a substring (in this case two consecutive letters between A and M followed by a digit) in SQL.
Oracle 10g regular expression extensions are discussed here: http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200.pdf
Regards
Mike
SQL> SQL> SQL> SELECT COUNT(*) freq
3
SQL>
SQL> SELECT *
2 FROM V$VERSION;
BANNER
SQL>
R. P. wrote:
> Is there an Oracle character function returning the number of occurances
> of a substring in a string? INSTR() is close but not quite what I am
> looking for.
>
> Thanks,
> Rudy
Received on Sun Nov 06 2005 - 06:19:53 CST