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!

Using ROWNUM with SEQUENCE.NEXTVAL in select statement

2806543Dec 2 2014 — edited Dec 8 2014

  I have an emp table

  SQL> select * from emp;

     EMPNO ENAME

---------- ----------

      5000 JOHN

      5001 ADAM

      5002 MIKE

I need help writing a procedure to run "Select EMPNO||ENAME from emp" on one row at a time till the end of the table.

Trying to use the below statement with "N as a sequence.nextval". It does not work. Please help me resolving this.

select EMPNO||ENAME from emp

where rownum < N+1

minus

select EMPNO||ENAME from emp

where rownum < N;

This post has been answered by BluShadow on Dec 8 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2015
Added on Dec 2 2014
22 comments
4,583 views