You want to draw a Christmas tree using SQL query
SOLUTION:
Run the following query in Oracle database
SET heading
off
SET
feedback off
SET
pagesize 2000
SELECT DECODE(SIGN(FLOOR(maxwidth/2)-ROWNUM)
,1,LPAD( ' ', FLOOR(maxwidth/2)-(ROWNUM-1))
|| RPAD( '*', 2*(ROWNUM-1)+1, ' *')
,LPAD( '* * *', FLOOR(maxwidth/2)+3))
FROM
all_objects
,(SELECT 40 AS
maxwidth FROM dual)
WHERE ROWNUM < FLOOR(maxwidth/2) +5;
If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!
No comments:
Post a Comment