select
case
when lvl=1 then lpad('*',height,' ')
else
lpad(' ',height+1-lvl,' ') || rpad('0',lag(lvl) over (partition by 1 order by lvl) + lvl -2,'0')
end "Merry Christmas!"
from (
select
level lvl ,max(level) over (partition by 1) height
from dual connect by level < 11
)
returns...
*
0
000
00000
0000000
000000000
00000000000
0000000000000
000000000000000
00000000000000000
0000000000000000000