The sequencing for Super Type and Type void (Parent-child)

Data model is structured with Super Type Sub-Concept.When of Type of data are inserted into the table of Type Super, I'll use a primary Supertype.NEXTVAL sequence Key.Now the same sequence will also be the primary key of the table of Type void. Can I use Supertype.CURRVAL for inclusion in the table of Type void?

If so, I have a lot of folders being create table Super nature less than a second. So before data are inserted into the table of subtype there may be a chance of a row inserted into the table of Type Super and if I use Supertype.CURRVAL it can lead to erroneous data.

How can I make sure that the primary key Supertype is inserted as a primary key in the table of type void?

Within a single session, when you call seq.currval, you are guaranteed to get the same result every time you call as your session does not call to nextval. Other sessions will not affect values. So, as long as you do something like:

insert into parent values (seq.nextval, col1, col2);
insert into child calue (seq.currval, col3, col4);

the values are correct.

John

Tags: Database

Similar Questions

Maybe you are looking for