I am trying to replicate the following code in SQL Server to PostgreSQL:
declare @row int = 1 while (@row < 6) begin print replicate('* ', @row) set @row = @row + 1 end;
Required output
* * * * * * * * * * * * * * *
Advertisement
Answer
You can use generate_series()
select rpad('*', i, '*') from generate_series(1,5) as g(i)