Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Access to Oracle: Converting Autonumber fields

Re: Access to Oracle: Converting Autonumber fields

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 17 Jan 2005 08:39:17 -0800
Message-ID: <1105979957.060129.54780@f14g2000cwb.googlegroups.com>


If the table is updated from only one or a limited number of sources you can just code the insert as VALUES (sequence_name.nextval, col2, col3, ...) and not use a trigger to populate the value. Otherwise the before insert trigger allows you to insure population of the column when multiple insert sources are present and modification of the source code is not desired or possible.

Sometimes it is also desirable to code the before insert trigger to only populate the sequence generated value if the insert does not provide a value. This allows reinsertion of a row with a previously used value providing the value in question does not exist at the time of re-insertion. Applications that need to retrieve purged data from archive need this functionality.

HTH -- Mark D Powell -- Received on Mon Jan 17 2005 - 10:39:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US