What is the difference between ROWNUM and ROWID

Showing Answers 1 - 12 of 12 Answers

rameshnaidu

  • Mar 4th, 2006
 

the ROWNUM is a number(like serial no) which is dynamically changes.but the ROWID does not change.Because it is having the unique address,which is generated by the oracle

  Was this answer useful?  Yes

rownum is a pseudo column. It numbers the records in a result set. The first record that meets the where criteria in a select statement is given rownum=1, and every subsequent record meeting that same criteria increases rownum.

A rowid is a pseudo column (like versions_xid), that uniquely identifies a row within a table, but not within a database. It is possible for two rows of two different tables stored in the same cluster to have the same rowid.

  Was this answer useful?  Yes

nileshsingh

  • May 17th, 2006
 

rowid is a hexadecimal representation and
rownum is normal representation of rows uniquely.
 
SQL> select rowid,rownum,i from t1;
 
ROWID                                  ROWNUM     I
--------------------------------------------- --------------  ----------
AAAM6MAABAAAO8qAAA          1             1
AAAM6MAABAAAO8qAAB          2             2
AAAM6MAABAAAO8qAAC          3             3
AAAM6MAABAAAO8qAAD          4             4
AAAM6MAABAAAO8qAAE          5             5
 
SQL> select rowid,rownum,i from t1 where i in (1,2,4,5);
 
ROWID                                  ROWNUM     I
--------------------------------------------- --------------  ----------
AAAM6MAABAAAO8qAAA          1            1
AAAM6MAABAAAO8qAAB          2            2
AAAM6MAABAAAO8qAAD          3            4
AAAM6MAABAAAO8qAAE          4            5

  Was this answer useful?  Yes

roniprasan

  • Sep 2nd, 2007
 

Rowid is a?psudo column and system generated id to a row which is a alphanumaric value. It contains 16 charecters. Rownum is a psudo column which is a sequential order of numbers given to the rows.

  Was this answer useful?  Yes

g_sidhu

  • Feb 6th, 2008
 

Rowid:  Hexadecimal string representing the unique address of a row in its table. This datatype is primarily for values returned by the ROWID pseudocolumn.

 

Rownum: For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on. You can use ROWNUM to limit the number of rows returned by a query, as in this example:

 

SELECT * FROM employees WHERE ROWNUM < 10;

  Was this answer useful?  Yes

sampra

  • Feb 26th, 2008
 


the ROWNUM is a number(like serial no) which is dynamically changes.but the ROWID does not change.Because it is having the unique address,which is generated by the oracle

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions