Solved

INCLUDE ROWID VALUE IN THE TABLE

Posted on 2003-11-29
4
1,066 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
null value 15 94
select only modified column name  based on the status 15 48
Oracle RAC 12c 8 60
How can I rollback insert statements after commit in oracle? 7 65
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

862 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

23 Experts available now in Live!

Get 1:1 Help Now