oracle 9*9乘法口诀表

select replace(reverse(sys_connect_by_path(reverse(rownum || '*' || lv || '=' || rpad(rownum * lv, 2)),'/ ')),'/')
from (select level lv from dual connect by level < 10)
where lv = 1
connect by lv + 1 = prior lv;

-----------------------------------

declare
v_num1 number;
v_num2 number;
v_str varchar2(200);
begin
v_num1:=1;
v_num2:=1;
loop
loop
v_str:=v_str||to_char(v_num2)||'*'||to_char(v_num1)||'='||substr(to_char((v_num1*v_num2)||' '),1,2);
v_num2:=v_num2+1;
v_str:=v_str||' ';
exit when v_num2>v_num1;
end loop;
dbms_output.put_line(v_str);
v_num1:=v_num1+1;
v_str:='';
v_num2:=1;
exit when v_num1>9;
end loop;
end;

你可能感兴趣的:(oracle)