Sequencing Flashcards
Sequencing
Update dimension to add a sequence id column
Alter table xxxDIM ADD (xxxID number(2))
Create sequence
Create Sequence xxx_seq_id start with 1 increment by 1 maxvalue 99999999 minvalue 1 nocycle
Add sequence to ID column
Update xxxDim set xxxDIM = xxx_seq_id.nextval
Add id column to existing tempFact table
Alter table tempfact add (xxxID number(2))
Update tempfact to set the sequence id for its id column
Update tempfact tf set tf. xxx_id = (select from y. xxxID from xxxDIM y where y.aaa = tf.aaa)
Add sequence using ‘update method’ for 2 records
Update xxxDIM set xxxID = 1 where aaa = ‘…’ and Update xxxxDIM set xxxID = 2 where aaa = ‘…’
Update the tempfact sequence id to a sequence using a cursor
Declare cursor junkcursor is select * from junkDim; Begin for junkcursorrec in junkcursor LOOP update tempFact set junkID = junkcursorrec. junkID where aaa = junkcursorrec.aaa and bbb = junkcursorrec. bbb and ccc = junkcursorrec.ccc and ddd = junkcursorrec. ddd; End loop; End
Declare a cursor for the junkDIM
Declare cursor junkcursor is select * from junkDim