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
-~----------~----~----~----~------~----~------~--~---

Reply via email to