Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Access to Oracle: Converting Autonumber fields
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
![]() |
![]() |