Solved

INCLUDE ROWID VALUE IN THE TABLE

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
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 …

773 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