Solved

INCLUDE ROWID VALUE IN THE TABLE

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle 11g 23 106
Oracle SQL Select unique values from two columns 4 66
constraint check 2 48
oracle date format checking 7 26
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

839 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