Sort by

recency

|

1191 Discussions

|

  • + 0 comments

    Orcale:

    I have written a query in PL/SQL for pattern

    set serveroutput on;
    begin
    for i in reverse 1..20 loop
    for j in 1..i loop
    dbms_output.put('*');
    dbms_output.put(' ');
    end loop;
    dbms_output.new_line;
    end loop;
    end;
    /
    
  • + 0 comments

    SELECT LPAD('* ', 40 - 2*LEVEL + 2, '* ') || CHR(32) AS pattern FROM dual CONNECT BY LEVEL <= 20;

  • + 0 comments
    with recursive cte as(
    select repeat('* ',20) as p, 20 as n
    union all
    select repeat('* ',n-1),n-1 from cte where n>1)
    select p from cte;
    
  • + 1 comment

    with RECURSIVE numbers as ( select 20 as n union all select n-1 from numbers where n > 1 )

    select REPEAT('*',n) as stars from numbers

  • + 0 comments

    WITH RECURSIVE Stars AS (SELECT 20 AS S UNION ALL SELECT S-1 FROM Stars WHERE S >1) SELECT REPEAT('* ',S) FROM Stars;