set serverout on
declare
flag boolean;
begin
for i in 2..100 loop
flag:=true;
for j in 2..i-1 loop
if mod(i,j)=0 then
flag:=false;
end if;
end loop;
if flag=true then
dbms_output.put_line(i);
end if;
end loop;
end;
/
输出九九乘法表( nine-times table.sql)
set serveroutput on;
declare
begin
for i in 1..9 loop
for j in 1..i loop
dbms_output.put(i);
dbms_output.put('*');
dbms_output.put(j);
dbms_output.put('=');
dbms_output.put(i*j);
dbms_output.put(' ');
end loop;
dbms_output.put_line('');
end loop;
end;
/