T_SQL乘法口诀 ,oralce 乘法口诀

_SQL乘法口诀

 

declare @x int ,@y int ,@z varchar(1000)
set @x=1
set @y=1
set @z=''
while @x<=9
 begin
  set @y=1
   while @y<@x
    begin
    set @z=@z+Cast(@y As varchar(10))+'*'+Cast(@x As varchar(10))+'='+Cast(@y*@x as varchar(10))
    if @x*@y>=10
    set @z=@z+'   '
    else
    set @z=@z+'    '
    set @y=@y+1
    end
  print @z
  set @z =''
  set @x=@x+1
   
 end

 

 

oralce   乘法口诀

 

 

declare
n1
number:=1;
n2
number:=1;
begin
for n1 in 1..9
   
loop
   
for n2 in 1..n1
       
loop
       
if n2*n1>9 then
        dbms_output.put
(n2||'×'||n1||'='||n2*n1||'    ');
       
else
         dbms_output.put
(n2||'×'||n1||'='||n2*n1||'     ');
       
end if;
       
end loop;
       
    dbms_output.put_line
('');
   
end loop;
end;end;

你可能感兴趣的:(sql)