Solved

INCLUDE ROWID VALUE IN THE TABLE

Posted on 2003-11-29
4
1,051 Views
Last Modified: 2013-11-18
I created a table as
Create table table1 (col1   varchar2(10),
                           col2    number(5),
                          table1_rowid     rowid),
primary key is col1

I Want when I insert new row then the column table1_rowid must contains value of rowid of the same row. then how I can do that, what action and steps I have to do, I know that I have to create a trigger after insert of each row, but what is the plsql procedure I have to do.   Please can you provide me with cleared solution?

Tanks in advance
ORAHOT
0
Comment
Question by:balbanyab
4 Comments
 
LVL 15

Accepted Solution

by:
andrewst earned 50 total points
ID: 9842011
Don't bother - the row already has ROWID to do that, why try to duplicate it?  In any case, it wouldn't be trivial to do because until the row has been inserted it doesn't have a ROWID.  And to avoid the mutating table error you'd need 2 triggers: one AFTER INSERT FOR EACH ROW to store the ROWIDs in a package collection, and another AFTER INSERT (without FOR EACH ROW) to loop through the rows in the collection and issue this very silly and pointless update:

UPDATE table1 SET table1_rowid = ROWID
WHERE ROWID = rowid_collection(index);

Really, just don't do it!
0
 
LVL 6

Expert Comment

by:morphman
ID: 9842732
As andrew says, what is the point?

Once you have found the record with whichever query you have, then tha actual rowid is current. Rowids can change as well, when you do partition switches, and other physical file maintenance.

Not sure what happenes when you rebuild the indexes, the rowid might also change then, as they are not physically held ont eh database.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

709 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now