Re: how to handle ROWID in ON-INSERT trigger ?

From: Craig M. Wall <cwall_at_petersons.com>
Date: 1997/11/05
Message-ID: <63pt7q$2q8_at_news9.noc.netcom.net>#1/1


Tab,

Neither a user, application code nor a trigger can assign a rowid. The rowid is internally assigned by the database and refers to the physical location of the row in a block and it's datafile.

It's important to note a danger in using rowids, because this is a physical address of the row, the rowid can change when data is exported and then imported, so that reliance upon the rowid psuedo-column value as a key to link records "over time" risks the integrity of the data.

Perhaps you have been using the rowid as a unique identifier in your application for relating rows and now you want to control the assignment of this "id" via a trigger. A correct concept but the wrong approach. Instead create a numeric column with a primary key constraint. Then create your on-insert trigger for this table that selects the nextval from a sequence generator. After the generation of this number you can them use the curval of the sequence to populate detail rows in other tables to relate them to the just inserted one.

Regards,
Craig M. Wall

Tab Liao wrote in message <63p7e3$idr_at_netnews.hinet.net>...
>As title, I would like to know how to define the ROWID column and how
>to set it in ON-INSERT trigger of a database BLOCK.
>
>Any information would be appreciated. Thanks in advance.
>
>
>
>tabliao_at_ms14.hinet.net
>
>
Received on Wed Nov 05 1997 - 00:00:00 CET

Original text of this message