How to use Recursive query in db2
<p>I am learning to use recursive query in db2, got a problem online to print following pattern</p>

<pre><code> * 
 ** 
 *** 
 **** 
 ***** 
 ****** 
 ******* 
 ******** 
 ********* 
 ********** 
 *********** 
</code></pre>

<p>upto 20 level, solved it in Oracle using following query</p>

<pre><code>select lpad('*', level, '*') result  from dual  connect by level &lt;= 20 
</code></pre>

<p>but got no idea how to do it in db2, would really appreciate any help.</p>

<p>Also how to do it in reverse order, means how to print stars pyramid from 20th to 1st level?</p>