I'm guessing that this is what you want. Although I got a check sum of 7.
I deserve at least half of the credit for helping you with your homework!
PAVB, I don't think that you are too old. Since I work at a university
I can take classes. So I end up in computer classes with people half
my age. I would say that they are too young.
Code:SYS@devdb AS SYSDBA> DECLARE 2 v_string VARCHAR2(2000) := REPLACE('001 0072053 60 3716796', ' ', ''); 3 i PLS_INTEGER; 4 digitSum PLS_INTEGER := 0; 5 BEGIN 6 i := 1; 7 WHILE i < length(v_string) 8 LOOP 9 digitSum := digitSum + substr(v_string, i, 1); 10 i := i + 2; 11 END LOOP; 12 13 digitSum := digitSum * 3; 14 15 i := 0; 16 WHILE i < length(v_string) 17 LOOP 18 digitSum := digitSum + substr(v_string, i, 1); 19 i := i + 2; 20 END LOOP; 21 22 DBMS_OUTPUT.PUT_LINE('The check digit is: ' || MOD(digitSum, 10)); 23 END; 24 / The check digit is: 7 PL/SQL procedure successfully completed.






Reply With Quote