how to determine the number of instances of a character in string in Oracle
Posted on 2014-09-30
I want to determine how many of a certain letter in a string, e.g., MTWRF10,TR34,TBD
these are class periods, so M=Mon, T=Tues, R=Thurs, etc.
I want to determine how many M's, for example. I can't figure out how to do this in Sql, plus PL/SQL is probably better, no ?
I guess it would just be walking character by character and counting up, I suppose. The logic processes a day at a time, so as I process Monday, I would just walk through the string and count my M's (while ignoring TBD, etc.).
So if there is a Sql trick, please advise. If not, and you have a code snippet to address, that would be excellent.
(oracle is such a broad term, but that looks like the only topic that applies, I don't see PL/SQL).
(I also don't see where to assign points anymore . . . is everything now 500 points ???)