Home » SQL & PL/SQL » SQL & PL/SQL » Why ROWID starts with only 1?
Why ROWID starts with only 1? [message #234706] Thu, 03 May 2007 00:23 Go to next message
alayam
Messages: 8
Registered: November 2006
Location: Hyderabad
Junior Member

Hi! Friends..

I'm Requisting you all.

Why ROWID starts with only 1, why cant it accept otherthan 1 if give in the condition. Why we need to give ROWID = 1? What is the reason behind this?

Please anyone knows about this reply me soon. It svery urgent.

Thank you.
chandu.
Re: Why ROWID starts with only 1? [message #234709 is a reply to message #234706] Thu, 03 May 2007 00:30 Go to previous messageGo to next message
saibal
Messages: 111
Registered: March 2007
Location: India
Senior Member
Rowid=1? where did u get that? Do u mean rownum?
Re: Why ROWID starts with only 1? [message #234711 is a reply to message #234706] Thu, 03 May 2007 00:36 Go to previous messageGo to next message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
Hi,

seems you are talking about ROWNUM.
Answer to your question is in the provided link.

For your information, ROWID is described here.
Re: Why ROWID starts with only 1? [message #234715 is a reply to message #234711] Thu, 03 May 2007 00:45 Go to previous messageGo to next message
alayam
Messages: 8
Registered: November 2006
Location: Hyderabad
Junior Member

I'm thankful to u to responding for me question.

I'm taking about rowid only .. not about Rownum. I'm pretty clear about this question.

I'm attending interviews so everybody asking me this question.
I know rowid is pseudo column. and it starts with 1. if give other than 1 in the condition.. like where rowid= 2;
it will give error message.. but if we give rowid = 1;
it works fine.

i Would like to know what is the reason behind that.

please clear me if anybody knows.
Re: Why ROWID starts with only 1? [message #234716 is a reply to message #234715] Thu, 03 May 2007 00:48 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Why don't you check some manuals? You are talking about rownum and NOT rowid.
Plus: where rownum = 2 does not return an error, it just returns nothing.
Re: Why ROWID starts with only 1? [message #234731 is a reply to message #234715] Thu, 03 May 2007 01:04 Go to previous messageGo to next message
saibal
Messages: 111
Registered: March 2007
Location: India
Senior Member
If you are being asked in interviews about rowids beginning with 1, then I guess, your interviewers 'know something' that is not documented in the manuals. Take a very basic example:
scott@NEWDB-SQL>>select rowid from emp;

ROWID
------------------
AAAL+ZAAEAAAAAdAAA
AAAL+ZAAEAAAAAdAAB
AAAL+ZAAEAAAAAdAAC
AAAL+ZAAEAAAAAdAAD
AAAL+ZAAEAAAAAdAAE
AAAL+ZAAEAAAAAdAAF
AAAL+ZAAEAAAAAdAAG
AAAL+ZAAEAAAAAdAAH
AAAL+ZAAEAAAAAdAAI
AAAL+ZAAEAAAAAdAAJ
AAAL+ZAAEAAAAAdAAK
AAAL+ZAAEAAAAAdAAL
AAAL+ZAAEAAAAAdAAM
AAAL+ZAAEAAAAAdAAN

14 rows selected.

Do you see any '1' anywhere? I don't.
Hope this helps
Re: Why ROWID starts with only 1? [message #234890 is a reply to message #234706] Thu, 03 May 2007 07:13 Go to previous messageGo to next message
compcoder
Messages: 30
Registered: April 2007
Location: Maryland USA
Member
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.

Re: Why ROWID starts with only 1? [message #234894 is a reply to message #234890] Thu, 03 May 2007 07:18 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
You are just kidding, right?
Re: Why ROWID starts with only 1? [message #234896 is a reply to message #234706] Thu, 03 May 2007 07:22 Go to previous messageGo to next message
compcoder
Messages: 30
Registered: April 2007
Location: Maryland USA
Member
http://www.psoug.org/reference/pseudocols.html

[Updated on: Thu, 03 May 2007 07:23]

Report message to a moderator

Re: Why ROWID starts with only 1? [message #234898 is a reply to message #234896] Thu, 03 May 2007 07:26 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Is this 2 rows or 1 row with different parts for each table? Wink

Regards
Michel
Re: Why ROWID starts with only 1? [message #234902 is a reply to message #234706] Thu, 03 May 2007 07:32 Go to previous messageGo to next message
compcoder
Messages: 30
Registered: April 2007
Location: Maryland USA
Member
This is where I got the original information from:

http://www.adp-gmbh.ch/ora/concepts/rowid.html
Re: Why ROWID starts with only 1? [message #234962 is a reply to message #234902] Thu, 03 May 2007 09:57 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I think they need to correct their information.

From the Oracle Docs
ROWID
A globally unique identifier for a row in a database. 
It is created at the time the row is inserted into a table, and destroyed when it is removed from a table


To be fair, if you're using Clustered tables, then the situation is different. From here:
Every row in a nonclustered table is assigned a unique rowid that corresponds to the physical address of a
 row's row piece (or the initial row piece if the row is chained among multiple row pieces).
In the case of clustered tables, rows in different tables that are in the same data block can have the same rowid.

Re: Why ROWID starts with only 1? [message #235093 is a reply to message #234962] Fri, 04 May 2007 01:18 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
So, are you saying that it is a documentation bug?

MHE
Previous Topic: 10G Issue
Next Topic: Help need in tuning this query
Goto Forum:
  


Current Time: Sun Dec 04 02:36:12 CST 2016

Total time taken to generate the page: 0.21226 seconds