3.05.2015

Explain ROWID Vs ROWNUM?

ROWID
 
RowID is called the sudo column, presented in every table. If we look at the at rowid we will see a series of numbers and letters. 

A rowid is important because it uniquely identify a row in the entire database. We know, PK also uniquely identify a row in a table. But the rowid has the exact location information about the table data. It means, the rowid has the important information about the exact location of that row of data, like - what blocks it's in, what table it's in, what segment it's in etc. and all the way down to that level. 

So the fastest way to access a data would be if you know it's rowid. However, rowid can change by time if data is moved.

When you update a field in a row the ROWID never change.
When you delete a row the rowid deleted.

 
ROWNUM
 
Row number is a serial or sequencial number, that oracle generates for each row in resultset. ROWNUM changes depending on result set.

ROWID Vs ROWNUM - https://www.youtube.com/watch?v=nFfe3QMjCuM