Nice solutions guys but I think you are solving the wrong problem or atleast half of the actual problem. I have the complete solution but it does not satisfy my instinct to be a real programmer.
On the other hand, with David's Solution I feel that I need to go back to the start all over again to reach out all the available ways to do things.... :-D --Sonty On Jan 13, 4:04 am, "Michael Moore" <michaeljmo...@gmail.com> wrote: > we could shorten it a little > > DECLARE > mystr VARCHAR2 (1000) := '00AF 00F3'; > mychar CHAR (1); > total NUMBER (10) := 0; > BEGIN > FOR i IN 1 .. LENGTH (mystr) > LOOP > mychar := SUBSTR (mystr, i, 1); > > CASE > when instr('1248',mychar) !=0 then total := total +1; > when instr('3569AC',mychar) !=0 then total := total +2; > when instr('7BDE',mychar) !=0 then total := total +3; > when instr('F',mychar) !=0 then total := total +4; > ELSE NULL; > END CASE; > END LOOP; > dbms_output.put_line(to_char(total)); > END; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---