Getting count of occurances of a string in a column value
102480Nov 7 2007 — edited Feb 25 2011Hi,
Is there a way to get the number of occurences of a string in a single column value?
Example:
CREATE TABLE STRING_CNT(X VARCHAR2(100));
INSERT INTO STRING_CNT(X) VALUES('OracleXXOracleXXOracleXXOracle');
Commit;
Now the string 'Oracle' is repeated 4 times in the inserted value. I would like to get this count using SQL.Can some one tell me how to get this?
I was asked this interesting question in an interview today.