ROWNUM is a pseudo-column that's assigned an incremental, unique integer value for each row based on the order the rows were retrieved from a query. Therefore, the first row retrieved has ROWNUM of 1, the second row has ROWNUM of 2, and so on.
Limiting the number or rows returned
You can use this feature to limit the number of rows retrieved by a query:
The ROWNUM value is assigned to each row before any sorting of the result set takes place. Thus, the result set is returned in the order given by the ORDER BY clause. However, the ROWNUM values might not be in ascending order:
Adding a sequence number to rows in a table
The following example shows how you can add a sequence number to every row in the jobhist table. First add a column named seqno to the table. Then set seqno to ROWNUM in the UPDATE command.
The following SELECT command shows the new seqno values: