ROWID vs ROWNUM (or) What is the difference between ROWID and ROWNUM?

This post will explain the difference between the SQL functions rownum and rowid.

 

ROWID :

1). ROWID is a physical representation of allocation of memory and this is a permanent identity or address of a row.

2). ROWID is a 16-digit Hexadecimal number which looks similar to below pattern or format.

BBBBBBBB.RRRR.FFFF

Here B -> Block

R -> Row

F -> File

3). ROWID comprises of the position of the row, data object number, the data block in the data file, as well as data file in which the row resides.

4). ROWID will be generated automatically when the data is inserted into the table.

5). It is the fastest way of accessing the data from the tables.

 

ROWNUM :

1). ROWNUM is a representation of sequence allocated to any bunch of data that is retrieved.

2). This is a temporary assignment of sequence to the data.

3). ROWNUM is a numeric sequence

4). The output of ROWNUM is the sequence number of a row

5. ROWNUM will not assigned automatically when the data inserted. It is to be called explicitly.

6). ROWNUM has nothing to do with accessing the data from memory.

 

Please comment you thoughts..

Leave a Reply

Your email address will not be published. Required fields are marked *