Solved

INCLUDE ROWID VALUE IN THE TABLE

Posted on 2003-11-29
4
1,096 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
The viewer will learn how to count occurrences of each item in an array.
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 …

756 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