I have an Oracle Sql query which gives a list of months in a financial year. I want to convert to postgresql as it doesn't have level
select case
when to_char(add_months(sysdate , -1), 'MM') >= 4 then
to_char(add_months(sysdate , -1), 'YYYY') || '-' ||
to_char(to_number(to_char(add_months(sysdate , -1), 'YYYY')) + 1)
else
to_char(to_number(to_char(add_months(sysdate , -1), 'YYYY')) - 1) || '-' ||
to_char(add_months(sysdate , -1), 'YYYY')
end FY,
to_char(level, '00') MNTH
from dual
connect by level <=12