nimish@garg> select lpad('*',level,'*') from dual connect by level <= 5;
LPAD('*',LEVEL,'*')
---------------------------------------------------------------------------------
*
**
***
****
*****
nimish@garg> select lpad('*',5-level+1,'*') from dual connect by level <= 5;
LPAD('*',5-LEVEL+1,'*')
---------------------------------------------------------------------------------
*****
****
***
**
*
nimish@garg> select lpad(' ',5-level,' ') || lpad('*',level,'*') from dual connect by level <= 5;
LPAD('',5-LEVEL,'')||LPAD('*',LEVEL,'*')
------------------------------------------------------------------------------------------------------
*
**
***
****
*****
nimish@garg> select lpad(' ',level-1,' ') || lpad('*',5-level+1,'*') from dual connect by level <= 5;
LPAD('',LEVEL-1,'')||LPAD('*',5-LEVEL+1,'*')
---------------------------------------------------------------------------------------------------------
*****
****
***
**
*
nimish@garg> select lpad('*',5-level+1,'*') || lpad('*',level*2-1,' ') || lpad('*',5-level,'*') star_pattern
2 from dual connect by level <= 5
3 union all
4 select lpad('*',level,'*') || lpad('*',(5-level)*2+1,' ') || lpad('*',level-1,'*')
5 from dual connect by level <= 5;
STAR_PATTERN
-----------------------------------------------------------------------------------------------------------------
**********
**** ****
*** ***
** **
* *
* *
** **
*** ***
**** ****
**********
10 rows selected.
nimish@garg> select lpad(' ',5-level+1,' ') || lpad('*',level*2-1,'*') diamond
2 from dual connect by level <= 5
3 union all
4 select lpad(' ',level+1,' ') || lpad('*',(5-level)*2-1,'*') diamond
5 from dual connect by level <= 5;
DIAMOND
-----------------------------------------------------------------------------------------------------------------
*
***
*****
*******
*********
*******
*****
***
*
10 rows selected.
Star Pattern by SQL in Oracle Database
Star Patterns by SQL in Oracle -
Related Posts -
Subscribe to:
Post Comments (Atom)
This comment has been removed by the author.
ReplyDeleteNice article please do visit my website for oracle administrator certification training
ReplyDeleteThanks for sharing this interesting and useful blog..
ReplyDelete1Z0-144: Oracle Database 11g - Program with PL/SQL
Hi Sir/madam Great article and is appreciable. Great work and keep it up to the level of the sky. But sir/madam your article is incomplete and needs some moderation. I would suggest you to visit This article for complete information and making your article worth rewarding. But if you want a complete warehouse of articles on some interesting topics then visit This website . I hope you understood and may bright as a star in future. Cheers
ReplyDeleteThis site helps to clear your all query. vikram university ba 3rd year result
ReplyDeletevikram university bsc 3rd year result This is really worth reading. nice informative article.
Appreciate it
ReplyDeleteAwesome blog, thank you so much for sharing such an amazing information with us. Visit Preetidevelopers for Developers Real Estate, Royal Estate, Muda Mysore, and Villa Projects in Bangalore.
ReplyDeleteDevelopers Real Estate
โปรโมชั่น pg slot รวมโปรสล็อต PG โปรโมชั่นดีๆสุดพิเศษและก็ร้อนแรงมาเสนอแนะสำหรับคุณ สำหรับสาวกสล็อตตัวจริงต้องห้ามพลาดกับโปรโมชั่นที่พวกเราเตรียมความพร้อมมายกให้คุณทุกวัน
ReplyDelete