|
|
Archives of the TeradataForum
Message Posted: Thu, 23 Aug 2012 @ 22:22:41 GMT
Subj: | | Re: Number of times a string appears in a sentence |
|
From: | | Dieter Noeth |
Satyendra.Kumar wrote:
| How can we find the number of times a string appears in a sentence? Example: I am using a complex view which uses joins many times in the
query. I just want to count how many times 'JOIN' keyword appeared in the view. | |
If you already got the oReplace UDF:
(char_length(x) - char_length(oReplace(upper(x), 'JOIN', '')) /
char_length('JOIN')
Dieter
| |