By using length function it is possible to find number of
words in the sentence. First, we find
the length of the string and length of the same string without spaces. The
difference between them plus 1 will be the number of words in the sentence.
SELECT LENGTH('Oracle PL SQL') - LENGTH(REPLACE('Oracle PL SQL', ' ', '')) + 1 WordCount
from DUAL
No comments:
Post a Comment