Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sequential Rownums with Union

user-zt176May 18 2023

Hello,

I have a script like this:

select 1 no, name from xxx

union all

select 2 no, name from xxx

union all

select 2+rownum, name from xxx;

I want to add a query so that the row number continues from where it left off.

In other words, if the row numbers ended in the number 9, the new number should continue from 10.

I can't use with because script errors ‘invalid identifier’.
Thanks in advance for the answers.

This post has been answered by user-zt176 on May 18 2023
Jump to Answer
Comments
Post Details
Added on May 18 2023
6 comments
1,175 views