In this program, we have share the how to print star pattern in pl sql with the output. PL/SQL is one of three key programming languages which is only available with the Oracle Database.
Below is the program to print the star pattern in pl sql with the output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | declare n number:=10; i number:=1; j number; k number; begin while i<n loop j:=1; while j<n-i loop dbms_output.put(' '); j:=j+2; end loop; for k in 1..i loop dbms_output.put('*'); end loop; dbms_output.new_line; i:=i+2; end loop; end; / |
Output:
1 2 3 4 5 | * *** ***** ******* ********* |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | declare i number:=9; j number; k number; begin while i>=1 loop j:=9; while j>i loop dbms_output.put(' '); j:=j-2; end loop; for k in 1..i loop dbms_output.put('*'); end loop; dbms_output.new_line; i:=i-2; end loop; end; / |
Output:
1 2 3 4 5 | ********* ******* ***** *** * |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.