I try to translate the following oracle sql, which inserts 1000 rows with incremental values into a table:
insert into tableName (col1, col2, col3)
select 'AN' || (1000000 + ROWNUM), 'EXT' || (9000000 + ROWNUM), ROWNUM
from dual
Connect By ROWNUM <= 1000 ;
For Postgres support, i know i can substitute ROWNUM with ROW_NUMBER() OVER (), but i'm really getting a headache about translating the connect by statement. I have read about CTEs but i don't get how i can use this with an insert statement.
Does anyone know how to write this statement for postgresql? Thanks.