Oracle autonumber question

Jun 2, 2008
163
0
0
How do you generate a autonumber that needs to be put in more than one table to create a relationship?

For example I have 3 tables.

TBgenData
Proj_Num*
Proj_Name

TBdate
Date_ID*
Proj_Num
Date

TBfinancial
Fin_ID*
Date_ID
YTD_Budg

In this case, the Date_ID needs to be generated, and then put into the TBfinancial table and another table called TBschedule.

Thanks

EDIT* I believe sequences can be used but I don't understand how that all works out.

 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
Right. In Oracle, the only way to make a field autonumber is to create a sequence and a trigger and on insert, the trigger will assign the field the next value in the sequence.

Fun, right?