1 CREATE OR REPLACE FUNCTION GETGYS(NUM1 NUMBER, NUM2 NUMBER) RETURN NUMBER IS 2 RESULTNUM NUMBER; 3 NUM3 NUMBER; 4 MINNUM NUMBER; 5 BEGIN 6 IF NUM1 >= NUM2 THEN 7 MINNUM := NUM2; 8 ELSE 9 MINNUM := NUM1; 10 END IF; 11 NUM3 := MINNUM; 12 LOOP 13 IF (MOD(NUM1, NUM3) = 0 AND MOD(NUM2, NUM3) = 0) THEN 14 RESULTNUM := NUM3; 15 EXIT; 16 END IF; 17 NUM3 := NUM3 - 1; 18 END LOOP; 19 RETURN(RESULTNUM); 20 END GETGYS;
2015-02-26 15:23:56