天天看点

一条SQL生成九九乘法表

导读: 

  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; 

本文转自 牛海彬 51CTO博客,原文链接:http://blog.51cto.com/newhappy/76990,如需转载请自行联系原作者