Home » SQL & PL/SQL » SQL & PL/SQL » what is the rowid type ?
what is the rowid type ? [message #1380] Thu, 25 April 2002 00:58 Go to next message
massa
Messages: 12
Registered: April 2002
Junior Member
Like what is written in the subject, I would like to know what is exactly the rowid type. I'm working under Oracle8i and I don't understand what it is.
If someone know, thanks for your help.
Re: what is the rowid type ? [message #1386 is a reply to message #1380] Thu, 25 April 2002 05:50 Go to previous message
Epe
Messages: 99
Registered: March 2002
Member
Hello,

every row in a table has an address or id : rowid.
I.e.: SELECT ROWID, ename FROM emp WHERE deptno = 30;
ROWID ENAME
------------------ ----------
00000DD5.0000.0001 KRISHNAN
00000DD5.0001.0001 ARBUCKLE
00000DD5.0002.0001 NGUYEN

If you wrote a select : "select * from emp where rowid = '00000DD5.0000.0001'", you would get the row with ename = 'KRISHNAN'. The rowid is the most performant way to select a row from a table. If you want to use it that way, and you first want to store the rowid in a variable (so you could say "where rowid = rowid_variable"), then you should make the variable of type ROWID.
declare
tab_rid rowid;
amount number;
begin
select rowid
into tab_rid
from table1
where pkey = 1;
....
select field5
into amount
from table1
where rowid = tab_rid;
....
end;

For more info in the on-line Oracle Manuals see :
http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a76965/c10datyp.htm#918

Success,

epe
Previous Topic: Logging vs. Nologging
Next Topic: inserting values into table
Goto Forum:
  


Current Time: Fri Apr 26 07:59:14 CDT 2024