Oracle DBA 经典面试题
1.输出100以内的所有素数
DECLARE
Z INT;
BEGIN
FOR X IN 2 .. 100 LOOP
IF X = 2 THEN
DBMS_OUTPUT.PUT_LINE(X);
ELSIF X > 2 THEN
Z := 0;
FOR T IN 2 .. X - 1 LOOP
IF MOD(X, T) = 0 THEN
Z := Z + 1;
END IF;
END LOOP;
IF Z = 0 THEN
DBMS_OUTPUT.PUT_LINE(X);
END IF;
END IF;
END LOOP;
END;