现在的位置: 首页 > 综合 > 正文

一条SQL生成九九乘法表

2013年03月11日 ⁄ 综合 ⁄ 共 215字 ⁄ 字号 评论关闭
导读:
 
  with t as (select level as n from dual connect by level <=9) 
  select sys_connect_by_path(b.n || '*' || a.n || '=' || a.n * b.n, ' ') as 九九乘法表 
  from t a, t b 
  where a.n >= b.n and level = a.n 
  start with b.n=1 
  connect by a.n=prior a.n and b.n=prior b.n+1; 

 

抱歉!评论已关闭.