Re: automatic / auto-increment field, without trigger

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Fri, 10 Dec 2010 03:58:47 +0000 (UTC)
Message-ID: <pan.2010.12.10.03.58.47_at_gmail.com>



On Wed, 08 Dec 2010 23:59:49 -0800, fel0niousmonk wrote:

> if i don't have access to create a trigger, but can add/drop/alter
> tables.
>
> is there a way to define an automatic column (by sequence) in the create
> table sql without using a trigger?

Most databases use triggers under the hood for implementing the autoincrement  type. However, with oracle, there is another option: you can create your own type and declare the column to be of that type. That will prove to be a very interesting solution, especially if you try loading something using SQL*Loader or replicating the table to another schema or, god forbid, another database, using Golden Gate, for instance. I can even think of interesting moments with export import. You will learn what is the "transform" option in the impdp actually made for.

-- 
http://mgogala.byethost5.com
Received on Thu Dec 09 2010 - 21:58:47 CST

Original text of this message