dbTalk Databases Forums  

automatic / auto-increment field, without trigger

comp.databases.oracle.server comp.databases.oracle.server


Discuss automatic / auto-increment field, without trigger in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
fel0niousmonk
 
Posts: n/a

Default automatic / auto-increment field, without trigger - 12-09-2010 , 01:59 AM






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?

Reply With Quote
  #2  
Old   
BicycleRepairman
 
Posts: n/a

Default Re: automatic / auto-increment field, without trigger - 12-09-2010 , 07:23 AM






On Dec 9, 2:59*am, fel0niousmonk <fel0ni... (AT) gmail (DOT) com> wrote:
Quote:
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?
alter table foo add (myGUIDColumn raw(16) default sys_guid());

It's not a sequence, but it is guaranteed unique.

Reply With Quote
  #3  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: automatic / auto-increment field, without trigger - 12-09-2010 , 09:58 PM



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

Quote:
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 auto-
increment 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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.