plsql - PL/SQL - Working with a string! -


Suppose I have a string: "ABCDAA" I must find out that using an anonymous pl / sql block What is the most used letter in this string?

How can I do this?

  declare str varchar2 (6 characters): = 'ABCDA'; Alphabet varchar2 (26 characters): = 'abcdefghijklmnopqrstuvwxyz'; Most_frequent char: = ''; Max_count INTEGER: = 0; V_count INTEGER: = 0; Check CHAR: = ''; 1..26 Loop checking can begin in: = SUBSTR (alphabet, i, 1); For 1..length (str) loop if SUBSTR (str, k, 1) = TH_IN v_count: = v_count + 1; end if; End loop; If v_count & gt; Maximum count then maximum count: = v_count; Most_frequent: = checking; end if; V_count: = 0; End loop; Dbms_output.put_line ('The most often letter is'' most_frequent || '' ''); End;  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -